Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: content/renderer/service_worker/service_worker_context_client.h

Issue 2787883003: [ServiceWorker] Add EmbeddedWorkerInstanceHost Interface. (Closed)
Patch Set: Refine code comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_
6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ 6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/id_map.h" 17 #include "base/id_map.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "components/payments/content/payment_app.mojom.h" 22 #include "components/payments/content/payment_app.mojom.h"
23 #include "content/child/webmessageportchannel_impl.h" 23 #include "content/child/webmessageportchannel_impl.h"
24 #include "content/common/service_worker/embedded_worker.mojom.h"
24 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" 25 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h"
25 #include "content/common/service_worker/service_worker_status_code.h" 26 #include "content/common/service_worker/service_worker_status_code.h"
26 #include "content/common/service_worker/service_worker_types.h" 27 #include "content/common/service_worker/service_worker_types.h"
27 #include "ipc/ipc_listener.h" 28 #include "ipc/ipc_listener.h"
28 #include "mojo/public/cpp/bindings/binding.h" 29 #include "mojo/public/cpp/bindings/binding.h"
29 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" 30 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h"
30 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerError.h" 31 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerError.h"
31 #include "third_party/WebKit/public/platform/modules/serviceworker/service_worke r_event_status.mojom.h" 32 #include "third_party/WebKit/public/platform/modules/serviceworker/service_worke r_event_status.mojom.h"
32 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextClient.h" 33 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextClient.h"
33 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextProxy.h" 34 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextProxy.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // new instance. 78 // new instance.
78 static ServiceWorkerContextClient* ThreadSpecificInstance(); 79 static ServiceWorkerContextClient* ThreadSpecificInstance();
79 80
80 // Called on the main thread. 81 // Called on the main thread.
81 ServiceWorkerContextClient( 82 ServiceWorkerContextClient(
82 int embedded_worker_id, 83 int embedded_worker_id,
83 int64_t service_worker_version_id, 84 int64_t service_worker_version_id,
84 const GURL& service_worker_scope, 85 const GURL& service_worker_scope,
85 const GURL& script_url, 86 const GURL& script_url,
86 mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, 87 mojom::ServiceWorkerEventDispatcherRequest dispatcher_request,
88 mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host,
87 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client); 89 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client);
88 ~ServiceWorkerContextClient() override; 90 ~ServiceWorkerContextClient() override;
89 91
90 void OnMessageReceived(int thread_id, 92 void OnMessageReceived(int thread_id,
91 int embedded_worker_id, 93 int embedded_worker_id,
92 const IPC::Message& message); 94 const IPC::Message& message);
93 95
94 // WebServiceWorkerContextClient overrides. 96 // WebServiceWorkerContextClient overrides.
95 blink::WebURL Scope() const override; 97 blink::WebURL Scope() const override;
96 void GetClient( 98 void GetClient(
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 scoped_refptr<base::TaskRunner> worker_task_runner_; 327 scoped_refptr<base::TaskRunner> worker_task_runner_;
326 328
327 scoped_refptr<ServiceWorkerProviderContext> provider_context_; 329 scoped_refptr<ServiceWorkerProviderContext> provider_context_;
328 330
329 // Not owned; this object is destroyed when proxy_ becomes invalid. 331 // Not owned; this object is destroyed when proxy_ becomes invalid.
330 blink::WebServiceWorkerContextProxy* proxy_; 332 blink::WebServiceWorkerContextProxy* proxy_;
331 333
332 // This is bound on the worker thread. 334 // This is bound on the worker thread.
333 mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_; 335 mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_;
334 336
337 // This is bound on the main thread.
338 scoped_refptr<mojom::ThreadSafeEmbeddedWorkerInstanceHostAssociatedPtr>
339 instance_host_;
340
335 // Renderer-side object corresponding to WebEmbeddedWorkerInstance. 341 // Renderer-side object corresponding to WebEmbeddedWorkerInstance.
336 // This is valid from the ctor to workerContextDestroyed. 342 // This is valid from the ctor to workerContextDestroyed.
337 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client_; 343 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client_;
338 344
339 // Initialized on the worker thread in workerContextStarted and 345 // Initialized on the worker thread in workerContextStarted and
340 // destructed on the worker thread in willDestroyWorkerContext. 346 // destructed on the worker thread in willDestroyWorkerContext.
341 std::unique_ptr<WorkerContextData> context_; 347 std::unique_ptr<WorkerContextData> context_;
342 348
343 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); 349 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient);
344 }; 350 };
345 351
346 } // namespace content 352 } // namespace content
347 353
348 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ 354 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698