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

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

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Add missing ScopedAsyncTaskScheduler instance for the new unit tests; required by a recent change t… Created 3 years, 10 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 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 return blink::WebWorkerCreationErrorNone; 348 return blink::WebWorkerCreationErrorNone;
349 } 349 }
350 350
351 std::unique_ptr<SharedWorkerPendingInstance> pending_instance( 351 std::unique_ptr<SharedWorkerPendingInstance> pending_instance(
352 new SharedWorkerPendingInstance(std::move(instance))); 352 new SharedWorkerPendingInstance(std::move(instance)));
353 pending_instance->AddRequest(std::move(request)); 353 pending_instance->AddRequest(std::move(request));
354 return ReserveRenderProcessToCreateWorker(std::move(pending_instance)); 354 return ReserveRenderProcessToCreateWorker(std::move(pending_instance));
355 } 355 }
356 356
357 void SharedWorkerServiceImpl::ConnectToWorker(SharedWorkerMessageFilter* filter, 357 void SharedWorkerServiceImpl::ConnectToWorker(SharedWorkerMessageFilter* filter,
358 int route_id, 358 int worker_route_id,
359 int sent_message_port_id) { 359 const MessagePort& port) {
360 for (WorkerHostMap::const_iterator iter = worker_hosts_.begin(); 360 for (WorkerHostMap::const_iterator iter = worker_hosts_.begin();
361 iter != worker_hosts_.end(); 361 iter != worker_hosts_.end();
362 ++iter) { 362 ++iter) {
363 if (iter->second->FilterConnectionMessage(route_id, sent_message_port_id, 363 if (iter->second->SendConnectToWorker(worker_route_id, port, filter))
364 filter))
365 return; 364 return;
366 } 365 }
367 } 366 }
368 367
369 void SharedWorkerServiceImpl::DocumentDetached( 368 void SharedWorkerServiceImpl::DocumentDetached(
370 SharedWorkerMessageFilter* filter, 369 SharedWorkerMessageFilter* filter,
371 unsigned long long document_id) { 370 unsigned long long document_id) {
372 ScopedWorkerDependencyChecker checker(this); 371 ScopedWorkerDependencyChecker checker(this);
373 for (WorkerHostMap::const_iterator iter = worker_hosts_.begin(); 372 for (WorkerHostMap::const_iterator iter = worker_hosts_.begin();
374 iter != worker_hosts_.end(); 373 iter != worker_hosts_.end();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 ScopedWorkerDependencyChecker checker(this); 428 ScopedWorkerDependencyChecker checker(this);
430 ProcessRouteIdPair key(filter->render_process_id(), worker_route_id); 429 ProcessRouteIdPair key(filter->render_process_id(), worker_route_id);
431 if (!base::ContainsKey(worker_hosts_, key)) 430 if (!base::ContainsKey(worker_hosts_, key))
432 return; 431 return;
433 std::unique_ptr<SharedWorkerHost> host(worker_hosts_[key].release()); 432 std::unique_ptr<SharedWorkerHost> host(worker_hosts_[key].release());
434 worker_hosts_.erase(key); 433 worker_hosts_.erase(key);
435 host->WorkerScriptLoadFailed(); 434 host->WorkerScriptLoadFailed();
436 } 435 }
437 436
438 void SharedWorkerServiceImpl::WorkerConnected(SharedWorkerMessageFilter* filter, 437 void SharedWorkerServiceImpl::WorkerConnected(SharedWorkerMessageFilter* filter,
439 int message_port_id, 438 int connection_request_id,
440 int worker_route_id) { 439 int worker_route_id) {
441 if (SharedWorkerHost* host = 440 if (SharedWorkerHost* host =
442 FindSharedWorkerHost(filter->render_process_id(), worker_route_id)) 441 FindSharedWorkerHost(filter->render_process_id(), worker_route_id))
443 host->WorkerConnected(message_port_id); 442 host->WorkerConnected(connection_request_id);
444 } 443 }
445 444
446 void SharedWorkerServiceImpl::AllowFileSystem(SharedWorkerMessageFilter* filter, 445 void SharedWorkerServiceImpl::AllowFileSystem(SharedWorkerMessageFilter* filter,
447 int worker_route_id, 446 int worker_route_id,
448 const GURL& url, 447 const GURL& url,
449 IPC::Message* reply_msg) { 448 IPC::Message* reply_msg) {
450 if (SharedWorkerHost* host = 449 if (SharedWorkerHost* host =
451 FindSharedWorkerHost(filter->render_process_id(), worker_route_id)) { 450 FindSharedWorkerHost(filter->render_process_id(), worker_route_id)) {
452 host->AllowFileSystem(url, base::WrapUnique(reply_msg)); 451 host->AllowFileSystem(url, base::WrapUnique(reply_msg));
453 } else { 452 } else {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 UpdateWorkerDependencyFunc new_func) { 692 UpdateWorkerDependencyFunc new_func) {
694 update_worker_dependency_ = new_func; 693 update_worker_dependency_ = new_func;
695 } 694 }
696 695
697 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( 696 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting(
698 bool (*new_func)(int)) { 697 bool (*new_func)(int)) {
699 s_try_increment_worker_ref_count_ = new_func; 698 s_try_increment_worker_ref_count_ = new_func;
700 } 699 }
701 700
702 } // namespace content 701 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698