OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_WEBSHAREDWORKER_PROXY_H_ | 5 #ifndef CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
6 #define CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ | 6 #define CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
(...skipping 18 matching lines...) Expand all Loading... |
30 unsigned long long document_id, | 30 unsigned long long document_id, |
31 bool exists, | 31 bool exists, |
32 int route_id, | 32 int route_id, |
33 int render_view_route_id); | 33 int render_view_route_id); |
34 virtual ~WebSharedWorkerProxy(); | 34 virtual ~WebSharedWorkerProxy(); |
35 | 35 |
36 // Implementations of WebSharedWorker APIs | 36 // Implementations of WebSharedWorker APIs |
37 virtual bool isStarted(); | 37 virtual bool isStarted(); |
38 virtual void connect(WebKit::WebMessagePortChannel* channel, | 38 virtual void connect(WebKit::WebMessagePortChannel* channel, |
39 ConnectListener* listener); | 39 ConnectListener* listener); |
40 | |
41 // API is evolving from first form to the second form. | |
42 virtual void startWorkerContext(const WebKit::WebURL& script_url, | 40 virtual void startWorkerContext(const WebKit::WebURL& script_url, |
43 const WebKit::WebString& name, | 41 const WebKit::WebString& name, |
44 const WebKit::WebString& user_agent, | 42 const WebKit::WebString& user_agent, |
45 const WebKit::WebString& source_code, | 43 const WebKit::WebString& source_code, |
46 long long script_resource_appcache_id); | 44 long long script_resource_appcache_id); |
47 | |
48 virtual void startWorkerContext( | |
49 const WebKit::WebURL& script_url, | |
50 const WebKit::WebString& name, | |
51 const WebKit::WebString& user_agent, | |
52 const WebKit::WebString& source_code, | |
53 const WebKit::WebString& content_security_policy, | |
54 bool report_only, | |
55 long long script_resource_appcache_id); | |
56 | |
57 virtual void terminateWorkerContext(); | 45 virtual void terminateWorkerContext(); |
58 virtual void clientDestroyed(); | 46 virtual void clientDestroyed(); |
59 | 47 |
60 private: | 48 private: |
61 // IPC::Channel::Listener implementation. | 49 // IPC::Channel::Listener implementation. |
62 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 50 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
63 | 51 |
64 // Returns true if the worker is running (can send messages to it). | 52 // Returns true if the worker is running (can send messages to it). |
65 bool IsStarted(); | 53 bool IsStarted(); |
66 | 54 |
67 // Disconnects the worker (stops listening for incoming messages). | 55 // Disconnects the worker (stops listening for incoming messages). |
68 void Disconnect(); | 56 void Disconnect(); |
69 | 57 |
70 // Sends a message to the worker thread (forwarded via the RenderViewHost). | 58 // Sends a message to the worker thread (forwarded via the RenderViewHost). |
71 // If WorkerStarted() has not yet been called, message is queued. | 59 // If WorkerStarted() has not yet been called, message is queued. |
72 bool Send(IPC::Message*); | 60 bool Send(IPC::Message*); |
73 | 61 |
74 // Returns true if there are queued messages. | 62 // Returns true if there are queued messages. |
75 bool HasQueuedMessages() { return !queued_messages_.empty(); } | 63 bool HasQueuedMessages() { return !queued_messages_.empty(); } |
76 | 64 |
77 // Sends any messages currently in the queue. | 65 // Sends any messages currently in the queue. |
78 void SendQueuedMessages(); | 66 void SendQueuedMessages(); |
79 | 67 |
80 void CreateWorkerContext(const GURL& script_url, | 68 void CreateWorkerContext(const GURL& script_url, |
81 bool is_shared, | 69 bool is_shared, |
82 const string16& name, | 70 const string16& name, |
83 const string16& user_agent, | 71 const string16& user_agent, |
84 const string16& source_code, | 72 const string16& source_code, |
85 const string16& content_security_policy, | |
86 bool report_only, | |
87 int pending_route_id, | 73 int pending_route_id, |
88 int64 script_resource_appcache_id); | 74 int64 script_resource_appcache_id); |
89 void OnWorkerCreated(); | 75 void OnWorkerCreated(); |
90 | 76 |
91 | 77 |
92 // Routing id associated with this worker - used to receive messages from the | 78 // Routing id associated with this worker - used to receive messages from the |
93 // worker, and also to route messages to the worker (WorkerService contains | 79 // worker, and also to route messages to the worker (WorkerService contains |
94 // a map that maps between these renderer-side route IDs and worker-side | 80 // a map that maps between these renderer-side route IDs and worker-side |
95 // routing ids). | 81 // routing ids). |
96 int route_id_; | 82 int route_id_; |
(...skipping 13 matching lines...) Expand all Loading... |
110 // The id for the placeholder worker instance we've stored on the | 96 // The id for the placeholder worker instance we've stored on the |
111 // browser process (we need to pass this same route id back in when creating | 97 // browser process (we need to pass this same route id back in when creating |
112 // the worker). | 98 // the worker). |
113 int pending_route_id_; | 99 int pending_route_id_; |
114 ConnectListener* connect_listener_; | 100 ConnectListener* connect_listener_; |
115 | 101 |
116 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); | 102 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); |
117 }; | 103 }; |
118 | 104 |
119 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ | 105 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
OLD | NEW |