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

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

Issue 2138263002: Revert of Move content's shell connections to the IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « chrome/test/base/mash_browser_tests_main.cc ('k') | content/browser/browser_main_loop.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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 context->SetUserData(kDownloadManagerKeyName, download_manager); 145 context->SetUserData(kDownloadManagerKeyName, download_manager);
146 } 146 }
147 147
148 class BrowserContextShellConnectionHolder 148 class BrowserContextShellConnectionHolder
149 : public base::SupportsUserData::Data { 149 : public base::SupportsUserData::Data {
150 public: 150 public:
151 BrowserContextShellConnectionHolder( 151 BrowserContextShellConnectionHolder(
152 std::unique_ptr<shell::Connection> connection, 152 std::unique_ptr<shell::Connection> connection,
153 shell::mojom::ServiceRequest request) 153 shell::mojom::ServiceRequest request)
154 : root_connection_(std::move(connection)), 154 : root_connection_(std::move(connection)),
155 shell_connection_(MojoShellConnection::Create( 155 shell_connection_(MojoShellConnection::Create(std::move(request))) {}
156 std::move(request),
157 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))) {}
158 ~BrowserContextShellConnectionHolder() override {} 156 ~BrowserContextShellConnectionHolder() override {}
159 157
160 MojoShellConnection* shell_connection() { return shell_connection_.get(); } 158 MojoShellConnection* shell_connection() { return shell_connection_.get(); }
161 159
162 private: 160 private:
163 std::unique_ptr<shell::Connection> root_connection_; 161 std::unique_ptr<shell::Connection> root_connection_;
164 std::unique_ptr<MojoShellConnection> shell_connection_; 162 std::unique_ptr<MojoShellConnection> shell_connection_;
165 163
166 DISALLOW_COPY_AND_ASSIGN(BrowserContextShellConnectionHolder); 164 DISALLOW_COPY_AND_ASSIGN(BrowserContextShellConnectionHolder);
167 }; 165 };
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 mojo::GetProxy(&pid_receiver)); 426 mojo::GetProxy(&pid_receiver));
429 pid_receiver->SetPID(base::GetCurrentProcId()); 427 pid_receiver->SetPID(base::GetCurrentProcId());
430 428
431 BrowserContextShellConnectionHolder* connection_holder = 429 BrowserContextShellConnectionHolder* connection_holder =
432 new BrowserContextShellConnectionHolder( 430 new BrowserContextShellConnectionHolder(
433 shell->GetConnector()->Connect(&params), 431 shell->GetConnector()->Connect(&params),
434 std::move(service_request)); 432 std::move(service_request));
435 browser_context->SetUserData(kMojoShellConnection, connection_holder); 433 browser_context->SetUserData(kMojoShellConnection, connection_holder);
436 434
437 MojoShellConnection* connection = connection_holder->shell_connection(); 435 MojoShellConnection* connection = connection_holder->shell_connection();
438 connection->Start();
439 436
440 // New embedded service factories should be added to |connection| here. 437 // New embedded service factories should be added to |connection| here.
441 438
442 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 439 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
443 switches::kMojoLocalStorage)) { 440 switches::kMojoLocalStorage)) {
444 MojoApplicationInfo info; 441 MojoApplicationInfo info;
445 info.application_factory = 442 info.application_factory =
446 base::Bind(&user_service::CreateUserService, 443 base::Bind(&user_service::CreateUserService,
447 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 444 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
448 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); 445 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 << "Attempting to destroy a BrowserContext that never called " 483 << "Attempting to destroy a BrowserContext that never called "
487 << "Initialize()"; 484 << "Initialize()";
488 485
489 RemoveBrowserContextFromUserIdMap(this); 486 RemoveBrowserContextFromUserIdMap(this);
490 487
491 if (GetUserData(kDownloadManagerKeyName)) 488 if (GetUserData(kDownloadManagerKeyName))
492 GetDownloadManager(this)->Shutdown(); 489 GetDownloadManager(this)->Shutdown();
493 } 490 }
494 491
495 } // namespace content 492 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/base/mash_browser_tests_main.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698