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 #include "content/browser/service_worker/embedded_worker_instance.h" | 5 #include "content/browser/service_worker/embedded_worker_instance.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // Functor to sort by the .second element of a struct. | 29 // Functor to sort by the .second element of a struct. |
30 struct SecondGreater { | 30 struct SecondGreater { |
31 template <typename Value> | 31 template <typename Value> |
32 bool operator()(const Value& lhs, const Value& rhs) { | 32 bool operator()(const Value& lhs, const Value& rhs) { |
33 return lhs.second > rhs.second; | 33 return lhs.second > rhs.second; |
34 } | 34 } |
35 }; | 35 }; |
36 | 36 |
37 void NotifyWorkerReadyForInspectionOnUI(int worker_process_id, | 37 void NotifyWorkerReadyForInspectionOnUI(int worker_process_id, |
38 int worker_route_id) { | 38 int worker_route_id) { |
39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 39 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
40 ServiceWorkerDevToolsManager::GetInstance()->WorkerReadyForInspection( | 40 ServiceWorkerDevToolsManager::GetInstance()->WorkerReadyForInspection( |
41 worker_process_id, worker_route_id); | 41 worker_process_id, worker_route_id); |
42 } | 42 } |
43 | 43 |
44 void NotifyWorkerDestroyedOnUI(int worker_process_id, int worker_route_id) { | 44 void NotifyWorkerDestroyedOnUI(int worker_process_id, int worker_route_id) { |
45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 45 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
46 ServiceWorkerDevToolsManager::GetInstance()->WorkerDestroyed( | 46 ServiceWorkerDevToolsManager::GetInstance()->WorkerDestroyed( |
47 worker_process_id, worker_route_id); | 47 worker_process_id, worker_route_id); |
48 } | 48 } |
49 | 49 |
50 void NotifyWorkerStopIgnoredOnUI(int worker_process_id, int worker_route_id) { | 50 void NotifyWorkerStopIgnoredOnUI(int worker_process_id, int worker_route_id) { |
51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 51 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
52 ServiceWorkerDevToolsManager::GetInstance()->WorkerStopIgnored( | 52 ServiceWorkerDevToolsManager::GetInstance()->WorkerStopIgnored( |
53 worker_process_id, worker_route_id); | 53 worker_process_id, worker_route_id); |
54 } | 54 } |
55 | 55 |
56 void RegisterToWorkerDevToolsManagerOnUI( | 56 void RegisterToWorkerDevToolsManagerOnUI( |
57 int process_id, | 57 int process_id, |
58 const ServiceWorkerContextCore* service_worker_context, | 58 const ServiceWorkerContextCore* service_worker_context, |
59 const base::WeakPtr<ServiceWorkerContextCore>& service_worker_context_weak, | 59 const base::WeakPtr<ServiceWorkerContextCore>& service_worker_context_weak, |
60 int64 service_worker_version_id, | 60 int64 service_worker_version_id, |
61 const GURL& url, | 61 const GURL& url, |
62 const base::Callback<void(int worker_devtools_agent_route_id, | 62 const base::Callback<void(int worker_devtools_agent_route_id, |
63 bool wait_for_debugger)>& callback) { | 63 bool wait_for_debugger)>& callback) { |
64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 64 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
65 int worker_devtools_agent_route_id = MSG_ROUTING_NONE; | 65 int worker_devtools_agent_route_id = MSG_ROUTING_NONE; |
66 bool wait_for_debugger = false; | 66 bool wait_for_debugger = false; |
67 if (RenderProcessHost* rph = RenderProcessHost::FromID(process_id)) { | 67 if (RenderProcessHost* rph = RenderProcessHost::FromID(process_id)) { |
68 // |rph| may be NULL in unit tests. | 68 // |rph| may be NULL in unit tests. |
69 worker_devtools_agent_route_id = rph->GetNextRoutingID(); | 69 worker_devtools_agent_route_id = rph->GetNextRoutingID(); |
70 wait_for_debugger = | 70 wait_for_debugger = |
71 ServiceWorkerDevToolsManager::GetInstance()->WorkerCreated( | 71 ServiceWorkerDevToolsManager::GetInstance()->WorkerCreated( |
72 process_id, | 72 process_id, |
73 worker_devtools_agent_route_id, | 73 worker_devtools_agent_route_id, |
74 ServiceWorkerDevToolsManager::ServiceWorkerIdentifier( | 74 ServiceWorkerDevToolsManager::ServiceWorkerIdentifier( |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 case SCRIPT_EVALUATED: | 484 case SCRIPT_EVALUATED: |
485 return "Script evaluated"; | 485 return "Script evaluated"; |
486 case STARTING_PHASE_MAX_VALUE: | 486 case STARTING_PHASE_MAX_VALUE: |
487 NOTREACHED(); | 487 NOTREACHED(); |
488 } | 488 } |
489 NOTREACHED() << phase; | 489 NOTREACHED() << phase; |
490 return std::string(); | 490 return std::string(); |
491 } | 491 } |
492 | 492 |
493 } // namespace content | 493 } // namespace content |
OLD | NEW |