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

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

Issue 2740493002: Pref service: create service at browser startup (Closed)
Patch Set: Merge 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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 455
456 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 456 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
457 switches::kMojoLocalStorage)) { 457 switches::kMojoLocalStorage)) {
458 ServiceInfo info; 458 ServiceInfo info;
459 info.factory = 459 info.factory =
460 base::Bind(&file::CreateFileService, 460 base::Bind(&file::CreateFileService,
461 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 461 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
462 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); 462 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB));
463 connection->AddEmbeddedService(file::mojom::kServiceName, info); 463 connection->AddEmbeddedService(file::mojom::kServiceName, info);
464 } 464 }
465
466 ContentBrowserClient::StaticServiceMap services;
467 browser_context->RegisterInProcessServices(&services);
468 for (const auto& entry : services) {
469 connection->AddEmbeddedService(entry.first, entry.second);
470 }
465 connection->Start(); 471 connection->Start();
466 } 472 }
467 } 473 }
468 474
469 // static 475 // static
470 const std::string& BrowserContext::GetServiceUserIdFor( 476 const std::string& BrowserContext::GetServiceUserIdFor(
471 BrowserContext* browser_context) { 477 BrowserContext* browser_context) {
472 CHECK(browser_context->GetUserData(kMojoWasInitialized)) 478 CHECK(browser_context->GetUserData(kMojoWasInitialized))
473 << "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 "
474 << "never Initialize()ed."; 480 << "never Initialize()ed.";
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 if (GetUserData(kDownloadManagerKeyName)) 522 if (GetUserData(kDownloadManagerKeyName))
517 GetDownloadManager(this)->Shutdown(); 523 GetDownloadManager(this)->Shutdown();
518 } 524 }
519 525
520 void BrowserContext::ShutdownStoragePartitions() { 526 void BrowserContext::ShutdownStoragePartitions() {
521 if (GetUserData(kStoragePartitionMapKeyName)) 527 if (GetUserData(kStoragePartitionMapKeyName))
522 RemoveUserData(kStoragePartitionMapKeyName); 528 RemoveUserData(kStoragePartitionMapKeyName);
523 } 529 }
524 530
525 } // namespace content 531 } // namespace content
OLDNEW
« no previous file with comments | « components/sync_preferences/pref_service_syncable_factory.cc ('k') | content/public/browser/browser_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698