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

Side by Side Diff: mojo/public/cpp/environment/lib/default_async_waiter.cc

Issue 345463003: Mojo: MojoWaitFlags -> MojoHandleSignals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/public/cpp/environment/default_async_waiter.h" 5 #include "mojo/public/cpp/environment/default_async_waiter.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 8
9 #include "mojo/public/cpp/utility/run_loop.h" 9 #include "mojo/public/cpp/utility/run_loop.h"
10 #include "mojo/public/cpp/utility/run_loop_handler.h" 10 #include "mojo/public/cpp/utility/run_loop_handler.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 const Handle handle_; 54 const Handle handle_;
55 MojoAsyncWaitCallback callback_; 55 MojoAsyncWaitCallback callback_;
56 void* closure_; 56 void* closure_;
57 57
58 MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoopHandlerImpl); 58 MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoopHandlerImpl);
59 }; 59 };
60 60
61 MojoAsyncWaitID AsyncWait(MojoHandle handle, 61 MojoAsyncWaitID AsyncWait(MojoHandle handle,
62 MojoWaitFlags flags, 62 MojoHandleSignals signals,
63 MojoDeadline deadline, 63 MojoDeadline deadline,
64 MojoAsyncWaitCallback callback, 64 MojoAsyncWaitCallback callback,
65 void* closure) { 65 void* closure) {
66 RunLoop* run_loop = RunLoop::current(); 66 RunLoop* run_loop = RunLoop::current();
67 assert(run_loop); 67 assert(run_loop);
68 68
69 // |run_loop_handler| is destroyed either when the handle is ready or if 69 // |run_loop_handler| is destroyed either when the handle is ready or if
70 // CancelWait is invoked. 70 // CancelWait is invoked.
71 RunLoopHandlerImpl* run_loop_handler = 71 RunLoopHandlerImpl* run_loop_handler =
72 new RunLoopHandlerImpl(Handle(handle), callback, closure); 72 new RunLoopHandlerImpl(Handle(handle), callback, closure);
73 run_loop->AddHandler(run_loop_handler, Handle(handle), flags, deadline); 73 run_loop->AddHandler(run_loop_handler, Handle(handle), signals, deadline);
74 return reinterpret_cast<MojoAsyncWaitID>(run_loop_handler); 74 return reinterpret_cast<MojoAsyncWaitID>(run_loop_handler);
75 } 75 }
76 76
77 void CancelWait(MojoAsyncWaitID wait_id) { 77 void CancelWait(MojoAsyncWaitID wait_id) {
78 delete reinterpret_cast<RunLoopHandlerImpl*>(wait_id); 78 delete reinterpret_cast<RunLoopHandlerImpl*>(wait_id);
79 } 79 }
80 80
81 const MojoAsyncWaiter kDefaultAsyncWaiter = { 81 const MojoAsyncWaiter kDefaultAsyncWaiter = {
82 AsyncWait, 82 AsyncWait,
83 CancelWait 83 CancelWait
84 }; 84 };
85 85
86 } // namespace 86 } // namespace
87 87
88 const MojoAsyncWaiter* GetDefaultAsyncWaiter() { 88 const MojoAsyncWaiter* GetDefaultAsyncWaiter() {
89 return &kDefaultAsyncWaiter; 89 return &kDefaultAsyncWaiter;
90 } 90 }
91 91
92 } // namespace mojo 92 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/c/system/types.h ('k') | mojo/public/cpp/environment/tests/async_waiter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698