forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ServiceWorker: Mojofication of ServiceWorkerDispatcherHost
This patch is to mojofy ServiceWorkerDispatcherHost which is a browser-side MessageFilter handling chromium IPC. Most of IPCs from the renderer to the browser related to the service workers are going through this object, so I can mojofy all of the IPCs using this way. In this patch, the ordering issue is avoided by using AssociatedInterface bound to MessageChannel. As the first touch, I mojofied ProviderCreated. BUG=629701 Review-Url: https://codereview.chromium.org/2396273002 Cr-Commit-Position: refs/heads/master@{#425639}
- Loading branch information
1 parent
70aeb57
commit 804b3e4
Showing
16 changed files
with
185 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2016 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
module content.mojom; | ||
|
||
import "content/common/service_worker/service_worker_types.mojom"; | ||
|
||
// Per-process browser-side interface bound to ServiceWorkerDispatcherHost. | ||
// Each InterfacePtrs on the same render process will be bound to the same | ||
// ServiceWorkerDispatcherHost. | ||
interface ServiceWorkerDispatcherHost { | ||
OnProviderCreated(int32 provider_id, | ||
int32 route_id, | ||
ServiceWorkerProviderType provider_type, | ||
bool is_parent_frame_secure); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2016 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
module content.mojom; | ||
|
||
enum ServiceWorkerProviderType { | ||
SERVICE_WORKER_PROVIDER_UNKNOWN, | ||
|
||
// For ServiceWorker clients. | ||
SERVICE_WORKER_PROVIDER_FOR_WINDOW, | ||
SERVICE_WORKER_PROVIDER_FOR_WORKER, | ||
SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER, | ||
|
||
// For ServiceWorkers. | ||
SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, | ||
|
||
SERVICE_WORKER_PROVIDER_TYPE_LAST = | ||
SERVICE_WORKER_PROVIDER_FOR_CONTROLLER | ||
}; |
12 changes: 12 additions & 0 deletions
12
content/common/service_worker/service_worker_types.typemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright 2016 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
mojom = "//content/common/service_worker/service_worker_types.mojom" | ||
public_headers = [ "//content/common/service_worker/service_worker_types.h" ] | ||
traits_headers = | ||
[ "//content/common/service_worker/service_worker_types_traits.h" ] | ||
sources = [ | ||
"//content/common/service_worker/service_worker_types_traits.cc", | ||
] | ||
type_mappings = [ "content.mojom.ServiceWorkerProviderType=::content::ServiceWorkerProviderType" ] |
24 changes: 24 additions & 0 deletions
24
content/common/service_worker/service_worker_types_traits.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2016 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "content/common/service_worker/service_worker_types_traits.h" | ||
|
||
namespace mojo { | ||
|
||
content::mojom::ServiceWorkerProviderType EnumTraits< | ||
content::mojom::ServiceWorkerProviderType, | ||
content::ServiceWorkerProviderType>::ToMojom( | ||
content::ServiceWorkerProviderType input) { | ||
return static_cast<content::mojom::ServiceWorkerProviderType>(input); | ||
} | ||
|
||
bool EnumTraits<content::mojom::ServiceWorkerProviderType, | ||
content::ServiceWorkerProviderType>::FromMojom( | ||
content::mojom::ServiceWorkerProviderType input, | ||
content::ServiceWorkerProviderType* out) { | ||
*out = static_cast<content::ServiceWorkerProviderType>(input); | ||
return true; | ||
} | ||
|
||
} // namespace mojo |
24 changes: 24 additions & 0 deletions
24
content/common/service_worker/service_worker_types_traits.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2016 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_TRAITS_H_ | ||
#define CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_TRAITS_H_ | ||
|
||
#include "content/common/service_worker/service_worker_types.mojom.h" | ||
|
||
namespace mojo { | ||
|
||
template <> | ||
struct EnumTraits<content::mojom::ServiceWorkerProviderType, | ||
content::ServiceWorkerProviderType> { | ||
static content::mojom::ServiceWorkerProviderType ToMojom( | ||
content::ServiceWorkerProviderType input); | ||
|
||
static bool FromMojom(content::mojom::ServiceWorkerProviderType input, | ||
content::ServiceWorkerProviderType* out); | ||
}; | ||
|
||
} // namespace mojo | ||
|
||
#endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_TRAITS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters