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

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

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Cleanup Created 3 years, 11 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return blink::WebWorkerCreationErrorNone; 318 return blink::WebWorkerCreationErrorNone;
319 } 319 }
320 320
321 std::unique_ptr<SharedWorkerPendingInstance> pending_instance( 321 std::unique_ptr<SharedWorkerPendingInstance> pending_instance(
322 new SharedWorkerPendingInstance(std::move(instance))); 322 new SharedWorkerPendingInstance(std::move(instance)));
323 pending_instance->AddRequest(std::move(request)); 323 pending_instance->AddRequest(std::move(request));
324 return ReserveRenderProcessToCreateWorker(std::move(pending_instance)); 324 return ReserveRenderProcessToCreateWorker(std::move(pending_instance));
325 } 325 }
326 326
327 void SharedWorkerServiceImpl::ConnectToWorker( 327 void SharedWorkerServiceImpl::ConnectToWorker(
328 int route_id, 328 int worker_route_id,
329 int sent_message_port_id, 329 const MessagePort& port,
330 SharedWorkerMessageFilter* filter) { 330 SharedWorkerMessageFilter* filter) {
331 for (WorkerHostMap::const_iterator iter = worker_hosts_.begin(); 331 for (WorkerHostMap::const_iterator iter = worker_hosts_.begin();
332 iter != worker_hosts_.end(); 332 iter != worker_hosts_.end();
333 ++iter) { 333 ++iter) {
334 if (iter->second->FilterConnectionMessage(route_id, sent_message_port_id, 334 if (iter->second->SendConnectToWorker(worker_route_id, port, filter))
335 filter))
336 return; 335 return;
337 } 336 }
338 } 337 }
339 338
340 void SharedWorkerServiceImpl::DocumentDetached( 339 void SharedWorkerServiceImpl::DocumentDetached(
341 unsigned long long document_id, 340 unsigned long long document_id,
342 SharedWorkerMessageFilter* filter) { 341 SharedWorkerMessageFilter* filter) {
343 ScopedWorkerDependencyChecker checker(this); 342 ScopedWorkerDependencyChecker checker(this);
344 for (WorkerHostMap::const_iterator iter = worker_hosts_.begin(); 343 for (WorkerHostMap::const_iterator iter = worker_hosts_.begin();
345 iter != worker_hosts_.end(); 344 iter != worker_hosts_.end();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 ScopedWorkerDependencyChecker checker(this); 386 ScopedWorkerDependencyChecker checker(this);
388 ProcessRouteIdPair key(filter->render_process_id(), worker_route_id); 387 ProcessRouteIdPair key(filter->render_process_id(), worker_route_id);
389 if (!base::ContainsKey(worker_hosts_, key)) 388 if (!base::ContainsKey(worker_hosts_, key))
390 return; 389 return;
391 std::unique_ptr<SharedWorkerHost> host(worker_hosts_[key].release()); 390 std::unique_ptr<SharedWorkerHost> host(worker_hosts_[key].release());
392 worker_hosts_.erase(key); 391 worker_hosts_.erase(key);
393 host->WorkerScriptLoadFailed(); 392 host->WorkerScriptLoadFailed();
394 } 393 }
395 394
396 void SharedWorkerServiceImpl::WorkerConnected( 395 void SharedWorkerServiceImpl::WorkerConnected(
397 int message_port_id, 396 int connection_request_id,
398 int worker_route_id, 397 int worker_route_id,
399 SharedWorkerMessageFilter* filter) { 398 SharedWorkerMessageFilter* filter) {
400 if (SharedWorkerHost* host = 399 if (SharedWorkerHost* host =
401 FindSharedWorkerHost(filter->render_process_id(), worker_route_id)) 400 FindSharedWorkerHost(filter->render_process_id(), worker_route_id))
402 host->WorkerConnected(message_port_id); 401 host->WorkerConnected(connection_request_id);
403 } 402 }
404 403
405 void SharedWorkerServiceImpl::AllowFileSystem( 404 void SharedWorkerServiceImpl::AllowFileSystem(
406 int worker_route_id, 405 int worker_route_id,
407 const GURL& url, 406 const GURL& url,
408 IPC::Message* reply_msg, 407 IPC::Message* reply_msg,
409 SharedWorkerMessageFilter* filter) { 408 SharedWorkerMessageFilter* filter) {
410 if (SharedWorkerHost* host = 409 if (SharedWorkerHost* host =
411 FindSharedWorkerHost(filter->render_process_id(), worker_route_id)) { 410 FindSharedWorkerHost(filter->render_process_id(), worker_route_id)) {
412 host->AllowFileSystem(url, base::WrapUnique(reply_msg)); 411 host->AllowFileSystem(url, base::WrapUnique(reply_msg));
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 UpdateWorkerDependencyFunc new_func) { 669 UpdateWorkerDependencyFunc new_func) {
671 update_worker_dependency_ = new_func; 670 update_worker_dependency_ = new_func;
672 } 671 }
673 672
674 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( 673 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting(
675 bool (*new_func)(int)) { 674 bool (*new_func)(int)) {
676 s_try_increment_worker_ref_count_ = new_func; 675 s_try_increment_worker_ref_count_ = new_func;
677 } 676 }
678 677
679 } // namespace content 678 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698