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