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

Side by Side Diff: content/browser/browser_context.cc

Issue 2729733003: Change ServiceManagerConnectionImpl to run service request handlers on the IO thread. (Closed)
Patch Set: Fix startup race. Created 3 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/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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 pid_receiver->SetPID(base::GetCurrentProcId()); 443 pid_receiver->SetPID(base::GetCurrentProcId());
444 444
445 BrowserContextServiceManagerConnectionHolder* connection_holder = 445 BrowserContextServiceManagerConnectionHolder* connection_holder =
446 new BrowserContextServiceManagerConnectionHolder( 446 new BrowserContextServiceManagerConnectionHolder(
447 service_manager_connection->GetConnector()->Connect(identity), 447 service_manager_connection->GetConnector()->Connect(identity),
448 std::move(service_request)); 448 std::move(service_request));
449 browser_context->SetUserData(kServiceManagerConnection, connection_holder); 449 browser_context->SetUserData(kServiceManagerConnection, connection_holder);
450 450
451 ServiceManagerConnection* connection = 451 ServiceManagerConnection* connection =
452 connection_holder->service_manager_connection(); 452 connection_holder->service_manager_connection();
453 connection->Start();
454 453
455 // New embedded service factories should be added to |connection| here. 454 // New embedded service factories should be added to |connection| here.
456 455
457 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 456 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
458 switches::kMojoLocalStorage)) { 457 switches::kMojoLocalStorage)) {
459 ServiceInfo info; 458 ServiceInfo info;
460 info.factory = 459 info.factory =
461 base::Bind(&file::CreateFileService, 460 base::Bind(&file::CreateFileService,
462 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 461 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
463 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); 462 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB));
464 connection->AddEmbeddedService(file::mojom::kServiceName, info); 463 connection->AddEmbeddedService(file::mojom::kServiceName, info);
465 } 464 }
466 465
467 ContentBrowserClient::StaticServiceMap services; 466 ContentBrowserClient::StaticServiceMap services;
468 browser_context->RegisterInProcessServices(&services); 467 browser_context->RegisterInProcessServices(&services);
469 for (const auto& entry : services) { 468 for (const auto& entry : services) {
470 connection->AddEmbeddedService(entry.first, entry.second); 469 connection->AddEmbeddedService(entry.first, entry.second);
471 } 470 }
471 connection->Start();
472 } 472 }
473 } 473 }
474 474
475 // static 475 // static
476 const std::string& BrowserContext::GetServiceUserIdFor( 476 const std::string& BrowserContext::GetServiceUserIdFor(
477 BrowserContext* browser_context) { 477 BrowserContext* browser_context) {
478 CHECK(browser_context->GetUserData(kMojoWasInitialized)) 478 CHECK(browser_context->GetUserData(kMojoWasInitialized))
479 << "Attempting to get the mojo user id for a BrowserContext that was " 479 << "Attempting to get the mojo user id for a BrowserContext that was "
480 << "never Initialize()ed."; 480 << "never Initialize()ed.";
481 481
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 if (GetUserData(kDownloadManagerKeyName)) 522 if (GetUserData(kDownloadManagerKeyName))
523 GetDownloadManager(this)->Shutdown(); 523 GetDownloadManager(this)->Shutdown();
524 } 524 }
525 525
526 void BrowserContext::ShutdownStoragePartitions() { 526 void BrowserContext::ShutdownStoragePartitions() {
527 if (GetUserData(kStoragePartitionMapKeyName)) 527 if (GetUserData(kStoragePartitionMapKeyName))
528 RemoveUserData(kStoragePartitionMapKeyName); 528 RemoveUserData(kStoragePartitionMapKeyName);
529 } 529 }
530 530
531 } // namespace content 531 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | content/browser/service_manager/service_manager_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698