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

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

Issue 2804373002: Eliminate Connector::Connect(), Connection, etc. (Closed)
Patch Set: . Created 3 years, 8 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
« no previous file with comments | « components/font_service/font_service_app.cc ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 24 matching lines...) Expand all
35 #include "content/public/common/service_manager_connection.h" 35 #include "content/public/common/service_manager_connection.h"
36 #include "content/public/common/service_names.mojom.h" 36 #include "content/public/common/service_names.mojom.h"
37 #include "net/cookies/cookie_store.h" 37 #include "net/cookies/cookie_store.h"
38 #include "net/ssl/channel_id_service.h" 38 #include "net/ssl/channel_id_service.h"
39 #include "net/ssl/channel_id_store.h" 39 #include "net/ssl/channel_id_store.h"
40 #include "net/url_request/url_request_context.h" 40 #include "net/url_request/url_request_context.h"
41 #include "net/url_request/url_request_context_getter.h" 41 #include "net/url_request/url_request_context_getter.h"
42 #include "services/file/file_service.h" 42 #include "services/file/file_service.h"
43 #include "services/file/public/interfaces/constants.mojom.h" 43 #include "services/file/public/interfaces/constants.mojom.h"
44 #include "services/file/user_id_map.h" 44 #include "services/file/user_id_map.h"
45 #include "services/service_manager/public/cpp/connection.h"
46 #include "services/service_manager/public/cpp/connector.h" 45 #include "services/service_manager/public/cpp/connector.h"
47 #include "services/service_manager/public/interfaces/service.mojom.h" 46 #include "services/service_manager/public/interfaces/service.mojom.h"
48 #include "storage/browser/database/database_tracker.h" 47 #include "storage/browser/database/database_tracker.h"
49 #include "storage/browser/fileapi/external_mount_points.h" 48 #include "storage/browser/fileapi/external_mount_points.h"
50 49
51 using base::UserDataAdapter; 50 using base::UserDataAdapter;
52 51
53 namespace content { 52 namespace content {
54 53
55 namespace { 54 namespace {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 void SetDownloadManager(BrowserContext* context, 142 void SetDownloadManager(BrowserContext* context,
144 content::DownloadManager* download_manager) { 143 content::DownloadManager* download_manager) {
145 DCHECK_CURRENTLY_ON(BrowserThread::UI); 144 DCHECK_CURRENTLY_ON(BrowserThread::UI);
146 DCHECK(download_manager); 145 DCHECK(download_manager);
147 context->SetUserData(kDownloadManagerKeyName, download_manager); 146 context->SetUserData(kDownloadManagerKeyName, download_manager);
148 } 147 }
149 148
150 class BrowserContextServiceManagerConnectionHolder 149 class BrowserContextServiceManagerConnectionHolder
151 : public base::SupportsUserData::Data { 150 : public base::SupportsUserData::Data {
152 public: 151 public:
153 BrowserContextServiceManagerConnectionHolder( 152 explicit BrowserContextServiceManagerConnectionHolder(
154 std::unique_ptr<service_manager::Connection> connection,
155 service_manager::mojom::ServiceRequest request) 153 service_manager::mojom::ServiceRequest request)
156 : root_connection_(std::move(connection)), 154 : service_manager_connection_(ServiceManagerConnection::Create(
157 service_manager_connection_(ServiceManagerConnection::Create(
158 std::move(request), 155 std::move(request),
159 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))) {} 156 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))) {}
160 ~BrowserContextServiceManagerConnectionHolder() override {} 157 ~BrowserContextServiceManagerConnectionHolder() override {}
161 158
162 ServiceManagerConnection* service_manager_connection() { 159 ServiceManagerConnection* service_manager_connection() {
163 return service_manager_connection_.get(); 160 return service_manager_connection_.get();
164 } 161 }
165 162
166 private: 163 private:
167 std::unique_ptr<service_manager::Connection> root_connection_;
168 std::unique_ptr<ServiceManagerConnection> service_manager_connection_; 164 std::unique_ptr<ServiceManagerConnection> service_manager_connection_;
169 165
170 DISALLOW_COPY_AND_ASSIGN(BrowserContextServiceManagerConnectionHolder); 166 DISALLOW_COPY_AND_ASSIGN(BrowserContextServiceManagerConnectionHolder);
171 }; 167 };
172 168
173 } // namespace 169 } // namespace
174 170
175 // static 171 // static
176 void BrowserContext::AsyncObliterateStoragePartition( 172 void BrowserContext::AsyncObliterateStoragePartition(
177 BrowserContext* browser_context, 173 BrowserContext* browser_context,
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 431
436 service_manager::mojom::ServicePtr service; 432 service_manager::mojom::ServicePtr service;
437 service_manager::mojom::ServiceRequest service_request(&service); 433 service_manager::mojom::ServiceRequest service_request(&service);
438 434
439 service_manager::mojom::PIDReceiverPtr pid_receiver; 435 service_manager::mojom::PIDReceiverPtr pid_receiver;
440 service_manager::Identity identity(mojom::kBrowserServiceName, new_id); 436 service_manager::Identity identity(mojom::kBrowserServiceName, new_id);
441 service_manager_connection->GetConnector()->StartService( 437 service_manager_connection->GetConnector()->StartService(
442 identity, std::move(service), mojo::MakeRequest(&pid_receiver)); 438 identity, std::move(service), mojo::MakeRequest(&pid_receiver));
443 pid_receiver->SetPID(base::GetCurrentProcId()); 439 pid_receiver->SetPID(base::GetCurrentProcId());
444 440
441 service_manager_connection->GetConnector()->StartService(identity);
445 BrowserContextServiceManagerConnectionHolder* connection_holder = 442 BrowserContextServiceManagerConnectionHolder* connection_holder =
446 new BrowserContextServiceManagerConnectionHolder( 443 new BrowserContextServiceManagerConnectionHolder(
447 service_manager_connection->GetConnector()->Connect(identity),
448 std::move(service_request)); 444 std::move(service_request));
449 browser_context->SetUserData(kServiceManagerConnection, connection_holder); 445 browser_context->SetUserData(kServiceManagerConnection, connection_holder);
450 446
451 ServiceManagerConnection* connection = 447 ServiceManagerConnection* connection =
452 connection_holder->service_manager_connection(); 448 connection_holder->service_manager_connection();
453 449
454 // New embedded service factories should be added to |connection| here. 450 // New embedded service factories should be added to |connection| here.
455 451
456 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 452 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
457 switches::kMojoLocalStorage)) { 453 switches::kMojoLocalStorage)) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 if (GetUserData(kDownloadManagerKeyName)) 518 if (GetUserData(kDownloadManagerKeyName))
523 GetDownloadManager(this)->Shutdown(); 519 GetDownloadManager(this)->Shutdown();
524 } 520 }
525 521
526 void BrowserContext::ShutdownStoragePartitions() { 522 void BrowserContext::ShutdownStoragePartitions() {
527 if (GetUserData(kStoragePartitionMapKeyName)) 523 if (GetUserData(kStoragePartitionMapKeyName))
528 RemoveUserData(kStoragePartitionMapKeyName); 524 RemoveUserData(kStoragePartitionMapKeyName);
529 } 525 }
530 526
531 } // namespace content 527 } // namespace content
OLDNEW
« no previous file with comments | « components/font_service/font_service_app.cc ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698