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

Side by Side Diff: mojo/bindings/js/waiting_callback.h

Issue 651523002: [Mojo] Fix the namespace for HandleWrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « mojo/bindings/js/support.cc ('k') | mojo/bindings/js/waiting_callback.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 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 #ifndef MOJO_BINDINGS_JS_WAITING_CALLBACK_H_ 5 #ifndef MOJO_BINDINGS_JS_WAITING_CALLBACK_H_
6 #define MOJO_BINDINGS_JS_WAITING_CALLBACK_H_ 6 #define MOJO_BINDINGS_JS_WAITING_CALLBACK_H_
7 7
8 #include "gin/handle.h" 8 #include "gin/handle.h"
9 #include "gin/runner.h" 9 #include "gin/runner.h"
10 #include "gin/wrappable.h" 10 #include "gin/wrappable.h"
11 #include "mojo/bindings/js/handle.h" 11 #include "mojo/bindings/js/handle.h"
12 #include "mojo/bindings/js/handle_close_observer.h" 12 #include "mojo/bindings/js/handle_close_observer.h"
13 #include "mojo/public/c/environment/async_waiter.h" 13 #include "mojo/public/c/environment/async_waiter.h"
14 #include "mojo/public/cpp/system/core.h" 14 #include "mojo/public/cpp/system/core.h"
15 15
16 namespace mojo { 16 namespace mojo {
17 namespace js { 17 namespace js {
18 18
19 class WaitingCallback : public gin::Wrappable<WaitingCallback>, 19 class WaitingCallback : public gin::Wrappable<WaitingCallback>,
20 public gin::HandleCloseObserver { 20 public HandleCloseObserver {
21 public: 21 public:
22 static gin::WrapperInfo kWrapperInfo; 22 static gin::WrapperInfo kWrapperInfo;
23 23
24 // Creates a new WaitingCallback. 24 // Creates a new WaitingCallback.
25 static gin::Handle<WaitingCallback> Create( 25 static gin::Handle<WaitingCallback> Create(
26 v8::Isolate* isolate, 26 v8::Isolate* isolate,
27 v8::Handle<v8::Function> callback, 27 v8::Handle<v8::Function> callback,
28 gin::Handle<gin::HandleWrapper> handle_wrapper, 28 gin::Handle<HandleWrapper> handle_wrapper,
29 MojoHandleSignals signals); 29 MojoHandleSignals signals);
30 30
31 // Cancels the callback. Does nothing if a callback is not pending. This is 31 // Cancels the callback. Does nothing if a callback is not pending. This is
32 // implicitly invoked from the destructor but can be explicitly invoked as 32 // implicitly invoked from the destructor but can be explicitly invoked as
33 // necessary. 33 // necessary.
34 void Cancel(); 34 void Cancel();
35 35
36 private: 36 private:
37 WaitingCallback(v8::Isolate* isolate, 37 WaitingCallback(v8::Isolate* isolate,
38 v8::Handle<v8::Function> callback, 38 v8::Handle<v8::Function> callback,
39 gin::Handle<gin::HandleWrapper> handle_wrapper); 39 gin::Handle<HandleWrapper> handle_wrapper);
40 virtual ~WaitingCallback(); 40 virtual ~WaitingCallback();
41 41
42 // Callback from MojoAsyncWaiter. |closure| is the WaitingCallback. 42 // Callback from MojoAsyncWaiter. |closure| is the WaitingCallback.
43 static void CallOnHandleReady(void* closure, MojoResult result); 43 static void CallOnHandleReady(void* closure, MojoResult result);
44 44
45 // Invoked from CallOnHandleReady() (CallOnHandleReady() must be static). 45 // Invoked from CallOnHandleReady() (CallOnHandleReady() must be static).
46 void OnHandleReady(MojoResult result); 46 void OnHandleReady(MojoResult result);
47 47
48 // Invoked by the HandleWrapper if the handle is closed while this wait is 48 // Invoked by the HandleWrapper if the handle is closed while this wait is
49 // still in progress. 49 // still in progress.
50 virtual void OnWillCloseHandle() override; 50 virtual void OnWillCloseHandle() override;
51 51
52 base::WeakPtr<gin::Runner> runner_; 52 base::WeakPtr<gin::Runner> runner_;
53 MojoAsyncWaitID wait_id_; 53 MojoAsyncWaitID wait_id_;
54 54
55 gin::HandleWrapper* handle_wrapper_; 55 HandleWrapper* handle_wrapper_;
56 56
57 DISALLOW_COPY_AND_ASSIGN(WaitingCallback); 57 DISALLOW_COPY_AND_ASSIGN(WaitingCallback);
58 }; 58 };
59 59
60 } // namespace js 60 } // namespace js
61 } // namespace mojo 61 } // namespace mojo
62 62
63 #endif // MOJO_BINDINGS_JS_WAITING_CALLBACK_H_ 63 #endif // MOJO_BINDINGS_JS_WAITING_CALLBACK_H_
OLDNEW
« no previous file with comments | « mojo/bindings/js/support.cc ('k') | mojo/bindings/js/waiting_callback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698