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

Side by Side Diff: chrome/browser/apps/app_shim/app_shim_host_manager_mac.mm

Issue 2295063002: Use ChannelMojo between app shims and the browser process. (Closed)
Patch Set: Created 4 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h" 5 #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #include "chrome/common/chrome_paths.h" 22 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/mac/app_mode_common.h" 24 #include "chrome/common/mac/app_mode_common.h"
25 #include "components/version_info/version_info.h" 25 #include "components/version_info/version_info.h"
26 26
27 using content::BrowserThread; 27 using content::BrowserThread;
28 28
29 namespace { 29 namespace {
30 30
31 void CreateAppShimHost(const IPC::ChannelHandle& handle) { 31 void CreateAppShimHost(mojo::edk::ScopedPlatformHandle handle) {
32 // AppShimHost takes ownership of itself. 32 // AppShimHost takes ownership of itself.
33 (new AppShimHost)->ServeChannel(handle); 33 (new AppShimHost)->ServeChannel(std::move(handle));
34 } 34 }
35 35
36 base::FilePath GetDirectoryInTmpTemplate(const base::FilePath& user_data_dir) { 36 base::FilePath GetDirectoryInTmpTemplate(const base::FilePath& user_data_dir) {
37 base::FilePath temp_dir; 37 base::FilePath temp_dir;
38 CHECK(PathService::Get(base::DIR_TEMP, &temp_dir)); 38 CHECK(PathService::Get(base::DIR_TEMP, &temp_dir));
39 // Check that it's shorter than the IPC socket length (104) minus the 39 // Check that it's shorter than the IPC socket length (104) minus the
40 // intermediate folder ("/chrome-XXXXXX/") and kAppShimSocketShortName. 40 // intermediate folder ("/chrome-XXXXXX/") and kAppShimSocketShortName.
41 DCHECK_GT(83u, temp_dir.value().length()); 41 DCHECK_GT(83u, temp_dir.value().length());
42 return temp_dir.Append("chrome-XXXXXX"); 42 return temp_dir.Append("chrome-XXXXXX");
43 } 43 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void AppShimHostManager::ListenOnIOThread() { 151 void AppShimHostManager::ListenOnIOThread() {
152 DCHECK_CURRENTLY_ON(BrowserThread::IO); 152 DCHECK_CURRENTLY_ON(BrowserThread::IO);
153 if (!acceptor_->Listen()) { 153 if (!acceptor_->Listen()) {
154 BrowserThread::PostTask( 154 BrowserThread::PostTask(
155 BrowserThread::UI, FROM_HERE, 155 BrowserThread::UI, FROM_HERE,
156 base::Bind(&AppShimHostManager::OnListenError, this)); 156 base::Bind(&AppShimHostManager::OnListenError, this));
157 } 157 }
158 } 158 }
159 159
160 void AppShimHostManager::OnClientConnected( 160 void AppShimHostManager::OnClientConnected(
161 const IPC::ChannelHandle& handle) { 161 mojo::edk::ScopedPlatformHandle handle) {
162 DCHECK_CURRENTLY_ON(BrowserThread::IO); 162 DCHECK_CURRENTLY_ON(BrowserThread::IO);
163 BrowserThread::PostTask( 163 BrowserThread::PostTask(
164 BrowserThread::UI, FROM_HERE, 164 BrowserThread::UI, FROM_HERE,
165 base::Bind(&CreateAppShimHost, handle)); 165 base::Bind(&CreateAppShimHost, base::Passed(&handle)));
166 } 166 }
167 167
168 void AppShimHostManager::OnListenError() { 168 void AppShimHostManager::OnListenError() {
169 // TODO(tapted): Set a timeout and attempt to reconstruct the channel. Until 169 // TODO(tapted): Set a timeout and attempt to reconstruct the channel. Until
170 // cases where the error could occur are better known, just reset the acceptor 170 // cases where the error could occur are better known, just reset the acceptor
171 // to allow failure to be communicated via the test API. 171 // to allow failure to be communicated via the test API.
172 acceptor_.reset(); 172 acceptor_.reset();
173 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698