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_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
21 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "content/browser/service_worker/embedded_worker_status.h" | 23 #include "content/browser/service_worker/embedded_worker_status.h" |
24 #include "content/browser/service_worker/service_worker_metrics.h" | 24 #include "content/browser/service_worker/service_worker_metrics.h" |
25 #include "content/common/content_export.h" | 25 #include "content/common/content_export.h" |
26 #include "content/common/service_worker/embedded_worker.mojom.h" | 26 #include "content/common/service_worker/embedded_worker.mojom.h" |
27 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" | 27 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" |
28 #include "content/common/service_worker/service_worker_status_code.h" | 28 #include "content/common/service_worker/service_worker_status_code.h" |
29 #include "content/public/common/console_message_level.h" | |
30 #include "url/gurl.h" | 29 #include "url/gurl.h" |
31 | 30 |
32 // Windows headers will redefine SendMessage. | 31 // Windows headers will redefine SendMessage. |
33 #ifdef SendMessage | 32 #ifdef SendMessage |
34 #undef SendMessage | 33 #undef SendMessage |
35 #endif | 34 #endif |
36 | 35 |
37 namespace IPC { | 36 namespace IPC { |
38 class Message; | 37 class Message; |
39 } | 38 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 void OnWorkerVersionInstalled(); | 172 void OnWorkerVersionInstalled(); |
174 | 173 |
175 // Called when the worker is doomed. | 174 // Called when the worker is doomed. |
176 void OnWorkerVersionDoomed(); | 175 void OnWorkerVersionDoomed(); |
177 | 176 |
178 // Called when the net::URLRequestJob to load the service worker script | 177 // Called when the net::URLRequestJob to load the service worker script |
179 // created. Not called for import scripts. | 178 // created. Not called for import scripts. |
180 void OnURLJobCreatedForMainScript(); | 179 void OnURLJobCreatedForMainScript(); |
181 | 180 |
182 // Add message to the devtools console. | 181 // Add message to the devtools console. |
183 void AddMessageToConsole(ConsoleMessageLevel level, | 182 void AddMessageToConsole(blink::WebConsoleMessage::Level level, |
184 const std::string& message); | 183 const std::string& message); |
185 | 184 |
186 static std::string StatusToString(EmbeddedWorkerStatus status); | 185 static std::string StatusToString(EmbeddedWorkerStatus status); |
187 static std::string StartingPhaseToString(StartingPhase phase); | 186 static std::string StartingPhaseToString(StartingPhase phase); |
188 | 187 |
189 void Detach(); | 188 void Detach(); |
190 | 189 |
191 base::WeakPtr<EmbeddedWorkerInstance> AsWeakPtr(); | 190 base::WeakPtr<EmbeddedWorkerInstance> AsWeakPtr(); |
192 | 191 |
193 private: | 192 private: |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 base::TimeTicks step_time_; | 329 base::TimeTicks step_time_; |
331 | 330 |
332 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; | 331 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; |
333 | 332 |
334 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); | 333 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); |
335 }; | 334 }; |
336 | 335 |
337 } // namespace content | 336 } // namespace content |
338 | 337 |
339 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 338 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
OLD | NEW |