OLD | NEW |
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_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ |
6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ | 6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" |
12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "content/browser/shared_worker/shared_worker_message_filter.h" | 15 #include "content/browser/shared_worker/shared_worker_message_filter.h" |
15 #include "content/browser/worker_host/worker_document_set.h" | 16 #include "content/browser/worker_host/worker_document_set.h" |
16 | 17 |
17 class GURL; | 18 class GURL; |
18 | 19 |
19 namespace IPC { | 20 namespace IPC { |
20 class Message; | 21 class Message; |
21 } | 22 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 void WorkerContextClosed(); | 58 void WorkerContextClosed(); |
58 void WorkerScriptLoaded(); | 59 void WorkerScriptLoaded(); |
59 void WorkerScriptLoadFailed(); | 60 void WorkerScriptLoadFailed(); |
60 void WorkerConnected(int message_port_id); | 61 void WorkerConnected(int message_port_id); |
61 void WorkerContextDestroyed(); | 62 void WorkerContextDestroyed(); |
62 void AllowDatabase(const GURL& url, | 63 void AllowDatabase(const GURL& url, |
63 const base::string16& name, | 64 const base::string16& name, |
64 const base::string16& display_name, | 65 const base::string16& display_name, |
65 unsigned long estimated_size, | 66 unsigned long estimated_size, |
66 bool* result); | 67 bool* result); |
67 void AllowFileSystem(const GURL& url, bool* result); | 68 void AllowFileSystem(const GURL& url, IPC::Message* reply_msg); |
68 void AllowIndexedDB(const GURL& url, | 69 void AllowIndexedDB(const GURL& url, |
69 const base::string16& name, | 70 const base::string16& name, |
70 bool* result); | 71 bool* result); |
71 | 72 |
72 // Terminates the given worker, i.e. based on a UI action. | 73 // Terminates the given worker, i.e. based on a UI action. |
73 void TerminateWorker(); | 74 void TerminateWorker(); |
74 | 75 |
75 void AddFilter(SharedWorkerMessageFilter* filter, int route_id); | 76 void AddFilter(SharedWorkerMessageFilter* filter, int route_id); |
76 | 77 |
77 SharedWorkerInstance* instance() { return instance_.get(); } | 78 SharedWorkerInstance* instance() { return instance_.get(); } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 SharedWorkerMessageFilter* incoming_filter); | 112 SharedWorkerMessageFilter* incoming_filter); |
112 | 113 |
113 // Return a vector of all the render process/render frame IDs. | 114 // Return a vector of all the render process/render frame IDs. |
114 std::vector<std::pair<int, int> > GetRenderFrameIDsForWorker(); | 115 std::vector<std::pair<int, int> > GetRenderFrameIDsForWorker(); |
115 | 116 |
116 void RemoveFilters(SharedWorkerMessageFilter* filter); | 117 void RemoveFilters(SharedWorkerMessageFilter* filter); |
117 bool HasFilter(SharedWorkerMessageFilter* filter, int route_id) const; | 118 bool HasFilter(SharedWorkerMessageFilter* filter, int route_id) const; |
118 void SetMessagePortID(SharedWorkerMessageFilter* filter, | 119 void SetMessagePortID(SharedWorkerMessageFilter* filter, |
119 int route_id, | 120 int route_id, |
120 int message_port_id); | 121 int message_port_id); |
121 | 122 void AllowFileSystemResponse(scoped_ptr<IPC::Message> reply_msg, |
| 123 bool allowed); |
122 scoped_ptr<SharedWorkerInstance> instance_; | 124 scoped_ptr<SharedWorkerInstance> instance_; |
123 scoped_refptr<WorkerDocumentSet> worker_document_set_; | 125 scoped_refptr<WorkerDocumentSet> worker_document_set_; |
| 126 base::WeakPtrFactory<SharedWorkerHost> weak_factory_; |
124 FilterList filters_; | 127 FilterList filters_; |
125 SharedWorkerMessageFilter* container_render_filter_; | 128 SharedWorkerMessageFilter* container_render_filter_; |
126 int worker_process_id_; | 129 int worker_process_id_; |
127 int worker_route_id_; | 130 int worker_route_id_; |
128 bool load_failed_; | 131 bool load_failed_; |
129 bool closed_; | 132 bool closed_; |
130 const base::TimeTicks creation_time_; | 133 const base::TimeTicks creation_time_; |
131 DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost); | 134 DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost); |
132 }; | 135 }; |
133 } // namespace content | 136 } // namespace content |
134 | 137 |
135 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ | 138 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ |
OLD | NEW |