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

Side by Side Diff: mojo/shell/app_child_process.cc

Issue 294833002: Mojo: more idiomatic C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/shell/app_child_process.h" 5 #include "mojo/shell/app_child_process.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 BindToPipe(impl.get(), host_message_pipe.Pass()); 186 BindToPipe(impl.get(), host_message_pipe.Pass());
187 187
188 app_context->set_controller(impl.Pass()); 188 app_context->set_controller(impl.Pass());
189 } 189 }
190 190
191 virtual void OnConnectionError() OVERRIDE { 191 virtual void OnConnectionError() OVERRIDE {
192 // TODO(darin): How should we handle a connection error here? 192 // TODO(darin): How should we handle a connection error here?
193 } 193 }
194 194
195 // |AppChildController| methods: 195 // |AppChildController| methods:
196 virtual void StartApp(const String& app_path, 196 virtual void StartApp(String app_path,
197 ScopedMessagePipeHandle service) OVERRIDE { 197 ScopedMessagePipeHandle service) OVERRIDE {
198 DVLOG(2) << "AppChildControllerImpl::StartApp(" 198 DVLOG(2) << "AppChildControllerImpl::StartApp(" << app_path << ", ...)";
199 << app_path.To<std::string>() << ", ...)";
200 DCHECK(thread_checker_.CalledOnValidThread()); 199 DCHECK(thread_checker_.CalledOnValidThread());
201 200
202 // TODO(darin): Add TypeConverter for FilePath <-> mojo::String.
203 unblocker_.Unblock(base::Bind(&AppChildControllerImpl::StartAppOnMainThread, 201 unblocker_.Unblock(base::Bind(&AppChildControllerImpl::StartAppOnMainThread,
204 base::FilePath::FromUTF8Unsafe( 202 base::FilePath::FromUTF8Unsafe(app_path),
205 app_path.To<std::string>()),
206 base::Passed(&service))); 203 base::Passed(&service)));
207 } 204 }
208 205
209 private: 206 private:
210 AppChildControllerImpl(AppContext* app_context, 207 AppChildControllerImpl(AppContext* app_context,
211 const Blocker::Unblocker& unblocker) 208 const Blocker::Unblocker& unblocker)
212 : app_context_(app_context), 209 : app_context_(app_context),
213 unblocker_(unblocker), 210 unblocker_(unblocker),
214 channel_info_(NULL) { 211 channel_info_(NULL) {
215 } 212 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 base::Bind(&AppChildControllerImpl::Init, base::Unretained(&app_context), 284 base::Bind(&AppChildControllerImpl::Init, base::Unretained(&app_context),
288 base::Passed(platform_channel()), blocker.GetUnblocker())); 285 base::Passed(platform_channel()), blocker.GetUnblocker()));
289 // This will block, then run whatever the controller wants. 286 // This will block, then run whatever the controller wants.
290 blocker.Block(); 287 blocker.Block();
291 288
292 app_context.Shutdown(); 289 app_context.Shutdown();
293 } 290 }
294 291
295 } // namespace shell 292 } // namespace shell
296 } // namespace mojo 293 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698