| 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 <memory> |
| 10 #include <set> |
| 10 #include <utility> | 11 #include <utility> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 15 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 17 #include "content/browser/shared_worker/worker_document_set.h" | 18 #include "content/browser/shared_worker/worker_document_set.h" |
| 18 | 19 |
| 19 class GURL; | 20 class GURL; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // Shuts down any shared workers that are no longer referenced by active | 56 // Shuts down any shared workers that are no longer referenced by active |
| 56 // documents. | 57 // documents. |
| 57 void DocumentDetached(SharedWorkerMessageFilter* filter, | 58 void DocumentDetached(SharedWorkerMessageFilter* filter, |
| 58 unsigned long long document_id); | 59 unsigned long long document_id); |
| 59 | 60 |
| 60 // Removes the references to shared workers from the all documents in the | 61 // Removes the references to shared workers from the all documents in the |
| 61 // renderer frame. And shuts down any shared workers that are no longer | 62 // renderer frame. And shuts down any shared workers that are no longer |
| 62 // referenced by active documents. | 63 // referenced by active documents. |
| 63 void RenderFrameDetached(int render_process_id, int render_frame_id); | 64 void RenderFrameDetached(int render_process_id, int render_frame_id); |
| 64 | 65 |
| 66 void CountFeature(uint32_t feature); |
| 65 void WorkerContextClosed(); | 67 void WorkerContextClosed(); |
| 68 void WorkerContextDestroyed(); |
| 66 void WorkerReadyForInspection(); | 69 void WorkerReadyForInspection(); |
| 67 void WorkerScriptLoaded(); | 70 void WorkerScriptLoaded(); |
| 68 void WorkerScriptLoadFailed(); | 71 void WorkerScriptLoadFailed(); |
| 69 void WorkerConnected(int message_port_id); | 72 void WorkerConnected(int message_port_id); |
| 70 void WorkerContextDestroyed(); | |
| 71 void AllowFileSystem(const GURL& url, | 73 void AllowFileSystem(const GURL& url, |
| 72 std::unique_ptr<IPC::Message> reply_msg); | 74 std::unique_ptr<IPC::Message> reply_msg); |
| 73 void AllowIndexedDB(const GURL& url, | 75 void AllowIndexedDB(const GURL& url, |
| 74 const base::string16& name, | 76 const base::string16& name, |
| 75 bool* result); | 77 bool* result); |
| 76 | 78 |
| 77 // Terminates the given worker, i.e. based on a UI action. | 79 // Terminates the given worker, i.e. based on a UI action. |
| 78 void TerminateWorker(); | 80 void TerminateWorker(); |
| 79 | 81 |
| 80 void AddFilter(SharedWorkerMessageFilter* filter, int route_id); | 82 void AddFilter(SharedWorkerMessageFilter* filter, int route_id); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // valid because this host is destructed immediately after the filter is | 136 // valid because this host is destructed immediately after the filter is |
| 135 // closed (see SharedWorkerServiceImpl::OnSharedWorkerMessageFilterClosing). | 137 // closed (see SharedWorkerServiceImpl::OnSharedWorkerMessageFilterClosing). |
| 136 SharedWorkerMessageFilter* worker_render_filter_; | 138 SharedWorkerMessageFilter* worker_render_filter_; |
| 137 | 139 |
| 138 const int worker_process_id_; | 140 const int worker_process_id_; |
| 139 const int worker_route_id_; | 141 const int worker_route_id_; |
| 140 bool termination_message_sent_ = false; | 142 bool termination_message_sent_ = false; |
| 141 bool closed_ = false; | 143 bool closed_ = false; |
| 142 const base::TimeTicks creation_time_; | 144 const base::TimeTicks creation_time_; |
| 143 | 145 |
| 146 // This is the set of features that this worker has used. The values must be |
| 147 // from blink::UseCounter::Feature enum. |
| 148 std::set<uint32_t> used_features_; |
| 149 |
| 144 base::WeakPtrFactory<SharedWorkerHost> weak_factory_; | 150 base::WeakPtrFactory<SharedWorkerHost> weak_factory_; |
| 145 | 151 |
| 146 DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost); | 152 DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost); |
| 147 }; | 153 }; |
| 148 } // namespace content | 154 } // namespace content |
| 149 | 155 |
| 150 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ | 156 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ |
| OLD | NEW |