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/embedded_worker_devtools_manager.h" | 14 #include "content/browser/devtools/shared_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/shared_worker/worker_document_set.h" | 19 #include "content/browser/shared_worker/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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 const base::Closure& failure_cb, | 191 const base::Closure& failure_cb, |
192 bool (*try_increment_worker_ref_count)(int)) { | 192 bool (*try_increment_worker_ref_count)(int)) { |
193 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 193 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
194 if (!try_increment_worker_ref_count(worker_process_id_)) { | 194 if (!try_increment_worker_ref_count(worker_process_id_)) { |
195 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, failure_cb); | 195 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, failure_cb); |
196 return; | 196 return; |
197 } | 197 } |
198 bool pause_on_start = false; | 198 bool pause_on_start = false; |
199 if (is_new_worker_) { | 199 if (is_new_worker_) { |
200 pause_on_start = | 200 pause_on_start = |
201 EmbeddedWorkerDevToolsManager::GetInstance()->SharedWorkerCreated( | 201 SharedWorkerDevToolsManager::GetInstance()->WorkerCreated( |
202 worker_process_id_, worker_route_id_, instance_); | 202 worker_process_id_, worker_route_id_, instance_); |
203 } | 203 } |
204 BrowserThread::PostTask( | 204 BrowserThread::PostTask( |
205 BrowserThread::IO, FROM_HERE, base::Bind(success_cb, pause_on_start)); | 205 BrowserThread::IO, FROM_HERE, base::Bind(success_cb, pause_on_start)); |
206 } | 206 } |
207 | 207 |
208 private: | 208 private: |
209 friend class base::RefCountedThreadSafe<SharedWorkerReserver>; | 209 friend class base::RefCountedThreadSafe<SharedWorkerReserver>; |
210 ~SharedWorkerReserver() {} | 210 ~SharedWorkerReserver() {} |
211 | 211 |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 UpdateWorkerDependencyFunc new_func) { | 656 UpdateWorkerDependencyFunc new_func) { |
657 update_worker_dependency_ = new_func; | 657 update_worker_dependency_ = new_func; |
658 } | 658 } |
659 | 659 |
660 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( | 660 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( |
661 bool (*new_func)(int)) { | 661 bool (*new_func)(int)) { |
662 s_try_increment_worker_ref_count_ = new_func; | 662 s_try_increment_worker_ref_count_ = new_func; |
663 } | 663 } |
664 | 664 |
665 } // namespace content | 665 } // namespace content |
OLD | NEW |