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 "content/browser/service_worker/embedded_worker_registry.h" | 7 #include "content/browser/service_worker/embedded_worker_registry.h" |
8 #include "content/common/service_worker/embedded_worker_messages.h" | 8 #include "content/common/service_worker/embedded_worker_messages.h" |
9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 DCHECK_EQ(process_id_, -1); | 92 DCHECK_EQ(process_id_, -1); |
93 DCHECK_EQ(worker_devtools_agent_route_id_, MSG_ROUTING_NONE); | 93 DCHECK_EQ(worker_devtools_agent_route_id_, MSG_ROUTING_NONE); |
94 if (status == SERVICE_WORKER_OK) { | 94 if (status == SERVICE_WORKER_OK) { |
95 process_id_ = process_id; | 95 process_id_ = process_id; |
96 worker_devtools_agent_route_id_ = worker_devtools_agent_route_id; | 96 worker_devtools_agent_route_id_ = worker_devtools_agent_route_id; |
97 } else { | 97 } else { |
98 status_ = STOPPED; | 98 status_ = STOPPED; |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
| 102 void EmbeddedWorkerInstance::OnScriptLoaded() { |
| 103 // TODO(horo): Implement this. |
| 104 } |
| 105 |
| 106 void EmbeddedWorkerInstance::OnScriptLoadFailed() { |
| 107 } |
| 108 |
102 void EmbeddedWorkerInstance::OnStarted(int thread_id) { | 109 void EmbeddedWorkerInstance::OnStarted(int thread_id) { |
103 // Stop is requested before OnStarted is sent back from the worker. | 110 // Stop is requested before OnStarted is sent back from the worker. |
104 if (status_ == STOPPING) | 111 if (status_ == STOPPING) |
105 return; | 112 return; |
106 DCHECK(status_ == STARTING); | 113 DCHECK(status_ == STARTING); |
107 status_ = RUNNING; | 114 status_ = RUNNING; |
108 thread_id_ = thread_id; | 115 thread_id_ = thread_id; |
109 FOR_EACH_OBSERVER(Listener, listener_list_, OnStarted()); | 116 FOR_EACH_OBSERVER(Listener, listener_list_, OnStarted()); |
110 } | 117 } |
111 | 118 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // Sort descending by the reference count. | 181 // Sort descending by the reference count. |
175 std::sort(counted.begin(), counted.end(), SecondGreater()); | 182 std::sort(counted.begin(), counted.end(), SecondGreater()); |
176 | 183 |
177 std::vector<int> result(counted.size()); | 184 std::vector<int> result(counted.size()); |
178 for (size_t i = 0; i < counted.size(); ++i) | 185 for (size_t i = 0; i < counted.size(); ++i) |
179 result[i] = counted[i].first; | 186 result[i] = counted[i].first; |
180 return result; | 187 return result; |
181 } | 188 } |
182 | 189 |
183 } // namespace content | 190 } // namespace content |
OLD | NEW |