| 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 |
| 102 void EmbeddedWorkerInstance::OnStarted(int thread_id) { | 106 void EmbeddedWorkerInstance::OnStarted(int thread_id) { |
| 103 // Stop is requested before OnStarted is sent back from the worker. | 107 // Stop is requested before OnStarted is sent back from the worker. |
| 104 if (status_ == STOPPING) | 108 if (status_ == STOPPING) |
| 105 return; | 109 return; |
| 106 DCHECK(status_ == STARTING); | 110 DCHECK(status_ == STARTING); |
| 107 status_ = RUNNING; | 111 status_ = RUNNING; |
| 108 thread_id_ = thread_id; | 112 thread_id_ = thread_id; |
| 109 FOR_EACH_OBSERVER(Listener, listener_list_, OnStarted()); | 113 FOR_EACH_OBSERVER(Listener, listener_list_, OnStarted()); |
| 110 } | 114 } |
| 111 | 115 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // Sort descending by the reference count. | 178 // Sort descending by the reference count. |
| 175 std::sort(counted.begin(), counted.end(), SecondGreater()); | 179 std::sort(counted.begin(), counted.end(), SecondGreater()); |
| 176 | 180 |
| 177 std::vector<int> result(counted.size()); | 181 std::vector<int> result(counted.size()); |
| 178 for (size_t i = 0; i < counted.size(); ++i) | 182 for (size_t i = 0; i < counted.size(); ++i) |
| 179 result[i] = counted[i].first; | 183 result[i] = counted[i].first; |
| 180 return result; | 184 return result; |
| 181 } | 185 } |
| 182 | 186 |
| 183 } // namespace content | 187 } // namespace content |
| OLD | NEW |