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

Side by Side Diff: shell/child_main.cc

Issue 1082973004: Make mojo_shell_child not crash when done. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <unistd.h> 5 #include <unistd.h>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // Copy and assign allowed. 59 // Copy and assign allowed.
60 }; 60 };
61 61
62 Blocker() : event_(true, false) {} 62 Blocker() : event_(true, false) {}
63 ~Blocker() {} 63 ~Blocker() {}
64 64
65 void Block() { 65 void Block() {
66 DCHECK(run_after_.is_null()); 66 DCHECK(run_after_.is_null());
67 event_.Wait(); 67 event_.Wait();
68 run_after_.Run(); 68 if (!run_after_.is_null())
69 run_after_.Run();
69 } 70 }
70 71
71 Unblocker GetUnblocker() { return Unblocker(this); } 72 Unblocker GetUnblocker() { return Unblocker(this); }
72 73
73 private: 74 private:
74 base::WaitableEvent event_; 75 base::WaitableEvent event_;
75 base::Closure run_after_; 76 base::Closure run_after_;
76 77
77 DISALLOW_COPY_AND_ASSIGN(Blocker); 78 DISALLOW_COPY_AND_ASSIGN(Blocker);
78 }; 79 };
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 base::Bind(&shell::ChildControllerImpl::Init, 305 base::Bind(&shell::ChildControllerImpl::Init,
305 base::Unretained(&app_context), 306 base::Unretained(&app_context),
306 base::Passed(&platform_channel), blocker.GetUnblocker())); 307 base::Passed(&platform_channel), blocker.GetUnblocker()));
307 // This will block, then run whatever the controller wants. 308 // This will block, then run whatever the controller wants.
308 blocker.Block(); 309 blocker.Block();
309 310
310 app_context.Shutdown(); 311 app_context.Shutdown();
311 312
312 return 0; 313 return 0;
313 } 314 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698