OLD | NEW |
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/public/browser/browser_context.h" | 5 #include "content/public/browser/browser_context.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 ServiceManagerConnection* service_manager_connection = | 432 ServiceManagerConnection* service_manager_connection = |
433 ServiceManagerConnection::GetForProcess(); | 433 ServiceManagerConnection::GetForProcess(); |
434 if (service_manager_connection && base::ThreadTaskRunnerHandle::IsSet()) { | 434 if (service_manager_connection && base::ThreadTaskRunnerHandle::IsSet()) { |
435 // NOTE: Many unit tests create a TestBrowserContext without initializing | 435 // NOTE: Many unit tests create a TestBrowserContext without initializing |
436 // Mojo or the global service manager connection. | 436 // Mojo or the global service manager connection. |
437 | 437 |
438 service_manager::mojom::ServicePtr service; | 438 service_manager::mojom::ServicePtr service; |
439 service_manager::mojom::ServiceRequest service_request(&service); | 439 service_manager::mojom::ServiceRequest service_request(&service); |
440 | 440 |
441 service_manager::mojom::PIDReceiverPtr pid_receiver; | 441 service_manager::mojom::PIDReceiverPtr pid_receiver; |
442 service_manager::Connector::ConnectParams params( | 442 service_manager::Identity identity(mojom::kBrowserServiceName, new_id); |
443 service_manager::Identity(mojom::kBrowserServiceName, new_id)); | 443 service_manager_connection->GetConnector()->Start( |
444 params.set_client_process_connection(std::move(service), | 444 identity, std::move(service), mojo::MakeRequest(&pid_receiver)); |
445 mojo::MakeRequest(&pid_receiver)); | |
446 pid_receiver->SetPID(base::GetCurrentProcId()); | 445 pid_receiver->SetPID(base::GetCurrentProcId()); |
447 | 446 |
448 BrowserContextServiceManagerConnectionHolder* connection_holder = | 447 BrowserContextServiceManagerConnectionHolder* connection_holder = |
449 new BrowserContextServiceManagerConnectionHolder( | 448 new BrowserContextServiceManagerConnectionHolder( |
450 service_manager_connection->GetConnector()->Connect(¶ms), | 449 service_manager_connection->GetConnector()->Connect(identity), |
451 std::move(service_request)); | 450 std::move(service_request)); |
452 browser_context->SetUserData(kServiceManagerConnection, connection_holder); | 451 browser_context->SetUserData(kServiceManagerConnection, connection_holder); |
453 | 452 |
454 ServiceManagerConnection* connection = | 453 ServiceManagerConnection* connection = |
455 connection_holder->service_manager_connection(); | 454 connection_holder->service_manager_connection(); |
456 connection->Start(); | 455 connection->Start(); |
457 | 456 |
458 // New embedded service factories should be added to |connection| here. | 457 // New embedded service factories should be added to |connection| here. |
459 // TODO(blundell): Does this belong as a global service rather than per | 458 // TODO(blundell): Does this belong as a global service rather than per |
460 // BrowserContext? | 459 // BrowserContext? |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 if (GetUserData(kDownloadManagerKeyName)) | 525 if (GetUserData(kDownloadManagerKeyName)) |
527 GetDownloadManager(this)->Shutdown(); | 526 GetDownloadManager(this)->Shutdown(); |
528 } | 527 } |
529 | 528 |
530 void BrowserContext::ShutdownStoragePartitions() { | 529 void BrowserContext::ShutdownStoragePartitions() { |
531 if (GetUserData(kStoragePartitionMapKeyName)) | 530 if (GetUserData(kStoragePartitionMapKeyName)) |
532 RemoveUserData(kStoragePartitionMapKeyName); | 531 RemoveUserData(kStoragePartitionMapKeyName); |
533 } | 532 } |
534 | 533 |
535 } // namespace content | 534 } // namespace content |
OLD | NEW |