Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: content/browser/worker_host/worker_service_impl.cc

Issue 154263004: Add commandline flag for ServiceWroker in the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add render_process_host_impl.cc worker_service_impl.cc worker_service.h Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/worker_host/worker_service_impl.h" 5 #include "content/browser/worker_host/worker_service_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "content/browser/devtools/worker_devtools_manager.h" 12 #include "content/browser/devtools/worker_devtools_manager.h"
13 #include "content/browser/renderer_host/render_widget_host_impl.h" 13 #include "content/browser/renderer_host/render_widget_host_impl.h"
14 #include "content/browser/shared_worker/shared_worker_service_impl.h"
14 #include "content/browser/worker_host/worker_message_filter.h" 15 #include "content/browser/worker_host/worker_message_filter.h"
15 #include "content/browser/worker_host/worker_process_host.h" 16 #include "content/browser/worker_host/worker_process_host.h"
16 #include "content/common/view_messages.h" 17 #include "content/common/view_messages.h"
17 #include "content/common/worker_messages.h" 18 #include "content/common/worker_messages.h"
18 #include "content/public/browser/child_process_data.h" 19 #include "content/public/browser/child_process_data.h"
19 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/notification_types.h" 21 #include "content/public/browser/notification_types.h"
21 #include "content/public/browser/render_frame_host.h" 22 #include "content/public/browser/render_frame_host.h"
22 #include "content/public/browser/render_process_host.h" 23 #include "content/public/browser/render_process_host.h"
23 #include "content/public/browser/render_view_host.h" 24 #include "content/public/browser/render_view_host.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 base::Bind(&WorkerPrioritySetter::OnRenderWidgetVisibilityChanged, 222 base::Bind(&WorkerPrioritySetter::OnRenderWidgetVisibilityChanged,
222 this, std::pair<int, int>(render_process_pid, render_widget_id))); 223 this, std::pair<int, int>(render_process_pid, render_widget_id)));
223 } 224 }
224 } 225 }
225 else if (type == NOTIFICATION_RENDERER_PROCESS_CREATED) { 226 else if (type == NOTIFICATION_RENDERER_PROCESS_CREATED) {
226 PostTaskToGatherAndUpdateWorkerPriorities(); 227 PostTaskToGatherAndUpdateWorkerPriorities();
227 } 228 }
228 } 229 }
229 230
230 WorkerService* WorkerService::GetInstance() { 231 WorkerService* WorkerService::GetInstance() {
231 return WorkerServiceImpl::GetInstance(); 232 if (EmbeddedSharedWorkerEnabled()) {
233 return SharedWorkerServiceImpl::GetInstance();
234 } else {
235 return WorkerServiceImpl::GetInstance();
236 }
kinuko 2014/03/11 07:40:19 nit: no need of { } for single-line body
horo 2014/03/11 07:49:20 Done.
237 }
238
239 bool WorkerService::EmbeddedSharedWorkerEnabled() {
240 static bool enabled = CommandLine::ForCurrentProcess()->HasSwitch(
241 switches::kEnableEmbeddedSharedWorker);
242 return enabled;
232 } 243 }
233 244
234 WorkerServiceImpl* WorkerServiceImpl::GetInstance() { 245 WorkerServiceImpl* WorkerServiceImpl::GetInstance() {
235 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 246 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
236 return Singleton<WorkerServiceImpl>::get(); 247 return Singleton<WorkerServiceImpl>::get();
237 } 248 }
238 249
239 WorkerServiceImpl::WorkerServiceImpl() 250 WorkerServiceImpl::WorkerServiceImpl()
240 : priority_setter_(new WorkerPrioritySetter()), 251 : priority_setter_(new WorkerPrioritySetter()),
241 next_worker_route_id_(0) { 252 next_worker_route_id_(0) {
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 instance_iter != iter->mutable_instances().end(); 591 instance_iter != iter->mutable_instances().end();
581 ++instance_iter) { 592 ++instance_iter) {
582 if (instance_iter->Matches(url, name, partition, resource_context)) 593 if (instance_iter->Matches(url, name, partition, resource_context))
583 return &(*instance_iter); 594 return &(*instance_iter);
584 } 595 }
585 } 596 }
586 return NULL; 597 return NULL;
587 } 598 }
588 599
589 } // namespace content 600 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/public/browser/worker_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698