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

Side by Side Diff: content/browser/shared_worker/shared_worker_service_impl.cc

Issue 185743004: Implement SharedWorkerServiceImpl::GetWorkers(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/shared_worker/shared_worker_host.h" 7 #include "content/browser/shared_worker/shared_worker_host.h"
8 #include "content/browser/shared_worker/shared_worker_instance.h" 8 #include "content/browser/shared_worker/shared_worker_instance.h"
9 #include "content/browser/shared_worker/shared_worker_message_filter.h" 9 #include "content/browser/shared_worker/shared_worker_message_filter.h"
10 #include "content/browser/worker_host/worker_document_set.h" 10 #include "content/browser/worker_host/worker_document_set.h"
(...skipping 14 matching lines...) Expand all
25 25
26 SharedWorkerServiceImpl::~SharedWorkerServiceImpl() { 26 SharedWorkerServiceImpl::~SharedWorkerServiceImpl() {
27 } 27 }
28 28
29 bool SharedWorkerServiceImpl::TerminateWorker(int process_id, int route_id) { 29 bool SharedWorkerServiceImpl::TerminateWorker(int process_id, int route_id) {
30 // TODO(horo): implement this. 30 // TODO(horo): implement this.
31 return false; 31 return false;
32 } 32 }
33 33
34 std::vector<WorkerService::WorkerInfo> SharedWorkerServiceImpl::GetWorkers() { 34 std::vector<WorkerService::WorkerInfo> SharedWorkerServiceImpl::GetWorkers() {
35 // TODO(horo): implement this.
36 std::vector<WorkerService::WorkerInfo> results; 35 std::vector<WorkerService::WorkerInfo> results;
36 for (WorkerHostMap::const_iterator iter = worker_hosts_.begin();
37 iter != worker_hosts_.end();
38 ++iter) {
39 SharedWorkerHost* host = iter->second;
40 const SharedWorkerInstance* instance = host->instance();
41 if (instance) {
42 WorkerService::WorkerInfo info;
43 info.url = instance->url();
44 info.name = instance->name();
45 info.route_id = host->worker_route_id();
46 info.process_id = host->process_id();
47 info.handle = host->container_render_filter()->PeerHandle();
48 results.push_back(info);
49 }
50 }
37 return results; 51 return results;
38 } 52 }
39 53
40 void SharedWorkerServiceImpl::AddObserver(WorkerServiceObserver* observer) { 54 void SharedWorkerServiceImpl::AddObserver(WorkerServiceObserver* observer) {
41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
42 observers_.AddObserver(observer); 56 observers_.AddObserver(observer);
43 } 57 }
44 58
45 void SharedWorkerServiceImpl::RemoveObserver(WorkerServiceObserver* observer) { 59 void SharedWorkerServiceImpl::RemoveObserver(WorkerServiceObserver* observer) {
46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 iter != worker_hosts_.end(); 243 iter != worker_hosts_.end();
230 ++iter) { 244 ++iter) {
231 SharedWorkerInstance* instance = iter->second->instance(); 245 SharedWorkerInstance* instance = iter->second->instance();
232 if (instance && instance->Matches(url, name, partition, resource_context)) 246 if (instance && instance->Matches(url, name, partition, resource_context))
233 return instance; 247 return instance;
234 } 248 }
235 return NULL; 249 return NULL;
236 } 250 }
237 251
238 } // namespace content 252 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698