| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/shared_worker/shared_worker_service_impl.h" | 5 #include "content/browser/shared_worker/shared_worker_service_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "content/browser/devtools/shared_worker_devtools_manager.h" | 14 #include "content/browser/devtools/embedded_worker_devtools_manager.h" |
| 15 #include "content/browser/renderer_host/render_process_host_impl.h" | 15 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 16 #include "content/browser/shared_worker/shared_worker_host.h" | 16 #include "content/browser/shared_worker/shared_worker_host.h" |
| 17 #include "content/browser/shared_worker/shared_worker_instance.h" | 17 #include "content/browser/shared_worker/shared_worker_instance.h" |
| 18 #include "content/browser/shared_worker/shared_worker_message_filter.h" | 18 #include "content/browser/shared_worker/shared_worker_message_filter.h" |
| 19 #include "content/browser/worker_host/worker_document_set.h" | 19 #include "content/browser/worker_host/worker_document_set.h" |
| 20 #include "content/common/view_messages.h" | 20 #include "content/common/view_messages.h" |
| 21 #include "content/common/worker_messages.h" | 21 #include "content/common/worker_messages.h" |
| 22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/browser/worker_service_observer.h" | 23 #include "content/public/browser/worker_service_observer.h" |
| 24 | 24 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 const base::Closure& failure_cb, | 186 const base::Closure& failure_cb, |
| 187 bool (*try_increment_worker_ref_count)(int)) { | 187 bool (*try_increment_worker_ref_count)(int)) { |
| 188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 189 if (!try_increment_worker_ref_count(worker_process_id_)) { | 189 if (!try_increment_worker_ref_count(worker_process_id_)) { |
| 190 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, failure_cb); | 190 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, failure_cb); |
| 191 return; | 191 return; |
| 192 } | 192 } |
| 193 bool pause_on_start = false; | 193 bool pause_on_start = false; |
| 194 if (is_new_worker_) { | 194 if (is_new_worker_) { |
| 195 pause_on_start = | 195 pause_on_start = |
| 196 SharedWorkerDevToolsManager::GetInstance()->WorkerCreated( | 196 EmbeddedWorkerDevToolsManager::GetInstance()->SharedWorkerCreated( |
| 197 worker_process_id_, worker_route_id_, instance_); | 197 worker_process_id_, worker_route_id_, instance_); |
| 198 } | 198 } |
| 199 BrowserThread::PostTask( | 199 BrowserThread::PostTask( |
| 200 BrowserThread::IO, FROM_HERE, base::Bind(success_cb, pause_on_start)); | 200 BrowserThread::IO, FROM_HERE, base::Bind(success_cb, pause_on_start)); |
| 201 } | 201 } |
| 202 | 202 |
| 203 private: | 203 private: |
| 204 friend class base::RefCountedThreadSafe<SharedWorkerReserver>; | 204 friend class base::RefCountedThreadSafe<SharedWorkerReserver>; |
| 205 ~SharedWorkerReserver() {} | 205 ~SharedWorkerReserver() {} |
| 206 | 206 |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 UpdateWorkerDependencyFunc new_func) { | 648 UpdateWorkerDependencyFunc new_func) { |
| 649 update_worker_dependency_ = new_func; | 649 update_worker_dependency_ = new_func; |
| 650 } | 650 } |
| 651 | 651 |
| 652 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( | 652 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( |
| 653 bool (*new_func)(int)) { | 653 bool (*new_func)(int)) { |
| 654 s_try_increment_worker_ref_count_ = new_func; | 654 s_try_increment_worker_ref_count_ = new_func; |
| 655 } | 655 } |
| 656 | 656 |
| 657 } // namespace content | 657 } // namespace content |
| OLD | NEW |