OLD | NEW |
1 // Copyright 2013 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_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ |
6 #define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "content/child/scoped_child_process_reference.h" | 15 #include "content/child/scoped_child_process_reference.h" |
16 #include "content/public/common/console_message_level.h" | |
17 #include "ipc/ipc_listener.h" | 16 #include "ipc/ipc_listener.h" |
18 | 17 |
19 namespace blink { | 18 namespace blink { |
20 | 19 |
21 class WebEmbeddedWorker; | 20 class WebEmbeddedWorker; |
22 | 21 |
23 } // namespace blink | 22 } // namespace blink |
24 | 23 |
25 namespace content { | 24 namespace content { |
26 | 25 |
(...skipping 28 matching lines...) Expand all Loading... |
55 return devtools_agent_.get(); | 54 return devtools_agent_.get(); |
56 } | 55 } |
57 | 56 |
58 private: | 57 private: |
59 ScopedChildProcessReference process_ref_; | 58 ScopedChildProcessReference process_ref_; |
60 std::unique_ptr<blink::WebEmbeddedWorker> worker_; | 59 std::unique_ptr<blink::WebEmbeddedWorker> worker_; |
61 std::unique_ptr<EmbeddedWorkerDevToolsAgent> devtools_agent_; | 60 std::unique_ptr<EmbeddedWorkerDevToolsAgent> devtools_agent_; |
62 }; | 61 }; |
63 | 62 |
64 void OnStopWorker(int embedded_worker_id); | 63 void OnStopWorker(int embedded_worker_id); |
65 void OnResumeAfterDownload(int embedded_worker_id); | |
66 void OnAddMessageToConsole(int embedded_worker_id, | |
67 ConsoleMessageLevel level, | |
68 const std::string& message); | |
69 | 64 |
70 std::unique_ptr<WorkerWrapper> StartWorkerContext( | 65 std::unique_ptr<WorkerWrapper> StartWorkerContext( |
71 const EmbeddedWorkerStartParams& params, | 66 const EmbeddedWorkerStartParams& params, |
72 std::unique_ptr<ServiceWorkerContextClient> context_client); | 67 std::unique_ptr<ServiceWorkerContextClient> context_client); |
73 | 68 |
74 // These methods are used by EmbeddedWorkerInstanceClientImpl to keep | 69 // These methods are used by EmbeddedWorkerInstanceClientImpl to keep |
75 // consistency between chromium IPC and mojo IPC. | 70 // consistency between chromium IPC and mojo IPC. |
76 // TODO(shimazu): Remove them after all messages for EmbeddedWorker are | 71 // TODO(shimazu): Remove them after all messages for EmbeddedWorker are |
77 // replaced by mojo IPC. (Tracking issue: https://crbug.com/629701) | 72 // replaced by mojo IPC. (Tracking issue: https://crbug.com/629701) |
78 void RegisterWorker(int embedded_worker_id, | 73 void RegisterWorker(int embedded_worker_id, |
79 std::unique_ptr<WorkerWrapper> wrapper); | 74 std::unique_ptr<WorkerWrapper> wrapper); |
80 void UnregisterWorker(int embedded_worker_id); | 75 void UnregisterWorker(int embedded_worker_id); |
81 void RecordStopWorkerTimer(int embedded_worker_id); | 76 void RecordStopWorkerTimer(int embedded_worker_id); |
82 | 77 |
83 IDMap<std::unique_ptr<WorkerWrapper>> workers_; | 78 IDMap<std::unique_ptr<WorkerWrapper>> workers_; |
84 std::map<int /* embedded_worker_id */, base::TimeTicks> stop_worker_times_; | 79 std::map<int /* embedded_worker_id */, base::TimeTicks> stop_worker_times_; |
85 base::WeakPtrFactory<EmbeddedWorkerDispatcher> weak_factory_; | 80 base::WeakPtrFactory<EmbeddedWorkerDispatcher> weak_factory_; |
86 | 81 |
87 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDispatcher); | 82 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDispatcher); |
88 }; | 83 }; |
89 | 84 |
90 } // namespace content | 85 } // namespace content |
91 | 86 |
92 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ | 87 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ |
OLD | NEW |