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

Side by Side Diff: content/renderer/shared_worker/embedded_shared_worker_stub.h

Issue 158953008: Implementations of SharedWorker in the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WorkerMessages
Patch Set: move shared_worker_devtools_agent to content/child Created 6 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_WORKER_WEBSHAREDWORKER_STUB_H_ 5 #ifndef CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H
6 #define CONTENT_WORKER_WEBSHAREDWORKER_STUB_H_ 6 #define CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "content/child/child_message_filter.h"
9 #include "content/child/scoped_child_process_reference.h" 9 #include "content/child/scoped_child_process_reference.h"
10 #include "content/worker/websharedworkerclient_proxy.h"
11 #include "content/worker/worker_webapplicationcachehost_impl.h"
12 #include "ipc/ipc_listener.h" 10 #include "ipc/ipc_listener.h"
13 #include "third_party/WebKit/public/web/WebSharedWorker.h" 11 #include "third_party/WebKit/public/platform/WebString.h"
12 #include "third_party/WebKit/public/web/WebContentSecurityPolicy.h"
13 #include "third_party/WebKit/public/web/WebSharedWorkerClient.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace blink { 16 namespace blink {
17 class WebApplicationCacheHost;
18 class WebApplicationCacheHostClient;
19 class WebMessagePortChannel;
20 class WebNotificationPresenter;
21 class WebSecurityOrigin;
17 class WebSharedWorker; 22 class WebSharedWorker;
23 class WebWorkerPermissionClientProxy;
18 } 24 }
19 25
20 namespace content { 26 namespace content {
21
22 class SharedWorkerDevToolsAgent; 27 class SharedWorkerDevToolsAgent;
23 class WebMessagePortChannelImpl; 28 class WebMessagePortChannelImpl;
24 29
25 // This class creates a WebSharedWorker, and translates incoming IPCs to the 30 class EmbeddedSharedWorkerStub : public IPC::Listener,
26 // appropriate WebSharedWorker APIs. 31 public blink::WebSharedWorkerClient {
27 class WebSharedWorkerStub : public IPC::Listener {
28 public: 32 public:
29 WebSharedWorkerStub(const GURL& url, 33 EmbeddedSharedWorkerStub(
30 const base::string16& name, 34 const GURL& url,
31 const base::string16& content_security_policy, 35 const base::string16& name,
32 blink::WebContentSecurityPolicyType security_policy_type, 36 const base::string16& content_security_policy,
33 int route_id); 37 blink::WebContentSecurityPolicyType security_policy_type,
38 int route_id);
34 39
35 // IPC::Listener implementation. 40 // IPC::Listener implementation.
36 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 41 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
37 virtual void OnChannelError() OVERRIDE; 42 virtual void OnChannelError() OVERRIDE;
38 43
39 // Invoked when the WebSharedWorkerClientProxy is shutting down. 44 // blink::WebSharedWorkerClient implementation.
40 void Shutdown(); 45 virtual void workerContextClosed() OVERRIDE;
41 46 virtual void workerContextDestroyed() OVERRIDE;
42 void WorkerScriptLoaded(); 47 virtual void workerScriptLoaded() OVERRIDE;
43 void WorkerScriptLoadFailed(); 48 virtual void workerScriptLoadFailed() OVERRIDE;
44 49 virtual void selectAppCacheID(long long) OVERRIDE;
45 // Called after terminating the worker context to make sure that the worker 50 virtual blink::WebNotificationPresenter* notificationPresenter() OVERRIDE;
46 // actually terminates (is not stuck in an infinite loop). 51 virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
47 void EnsureWorkerContextTerminates(); 52 blink::WebApplicationCacheHostClient*) OVERRIDE;
48 53 virtual blink::WebWorkerPermissionClientProxy*
49 WebSharedWorkerClientProxy* client() { return &client_; } 54 createWorkerPermissionClientProxy(
50 55 const blink::WebSecurityOrigin& origin) OVERRIDE;
51 // Returns the script url of this worker. 56 virtual void dispatchDevToolsMessage(
52 const GURL& url(); 57 const blink::WebString& message) OVERRIDE;
53 58 virtual void saveDevToolsAgentState(const blink::WebString& state) OVERRIDE;
54 59
55 private: 60 private:
56 virtual ~WebSharedWorkerStub(); 61 virtual ~EmbeddedSharedWorkerStub();
62
63 void Shutdown();
64 bool Send(IPC::Message* message);
57 65
58 void OnConnect(int sent_message_port_id, int routing_id); 66 void OnConnect(int sent_message_port_id, int routing_id);
59
60 void OnTerminateWorkerContext(); 67 void OnTerminateWorkerContext();
61 68
62 ScopedChildProcessReference process_ref_;
63
64 int route_id_; 69 int route_id_;
65 70 base::string16 name_;
66 // WebSharedWorkerClient that responds to outgoing API calls 71 bool runing_;
67 // from the worker object. 72 GURL url_;
68 WebSharedWorkerClientProxy client_;
69
70 blink::WebSharedWorker* impl_; 73 blink::WebSharedWorker* impl_;
71 bool running_;
72 GURL url_;
73 scoped_ptr<SharedWorkerDevToolsAgent> worker_devtools_agent_; 74 scoped_ptr<SharedWorkerDevToolsAgent> worker_devtools_agent_;
74 75
75 typedef std::vector<WebMessagePortChannelImpl*> PendingChannelList; 76 typedef std::vector<WebMessagePortChannelImpl*> PendingChannelList;
76 PendingChannelList pending_channels_; 77 PendingChannelList pending_channels_;
77 78
78 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerStub); 79 ScopedChildProcessReference process_ref_;
80 DISALLOW_COPY_AND_ASSIGN(EmbeddedSharedWorkerStub);
79 }; 81 };
80 82
81 } // namespace content 83 } // namespace content
82 84
83 #endif // CONTENT_WORKER_WEBSHAREDWORKER_STUB_H_ 85 #endif // CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698