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

Side by Side Diff: mojo/public/cpp/bindings/strong_binding.h

Issue 739493002: Introduce command buffer control thread (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address review comments Created 6 years, 1 month 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 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_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
7 7
8 #include "mojo/public/c/environment/async_waiter.h" 8 #include "mojo/public/c/environment/async_waiter.h"
9 #include "mojo/public/cpp/bindings/binding.h" 9 #include "mojo/public/cpp/bindings/binding.h"
10 #include "mojo/public/cpp/bindings/error_handler.h" 10 #include "mojo/public/cpp/bindings/error_handler.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 StrongBinding( 60 StrongBinding(
61 Interface* impl, 61 Interface* impl,
62 InterfaceRequest<Interface> request, 62 InterfaceRequest<Interface> request,
63 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) 63 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter())
64 : StrongBinding(impl) { 64 : StrongBinding(impl) {
65 binding_.Bind(request.Pass(), waiter); 65 binding_.Bind(request.Pass(), waiter);
66 } 66 }
67 67
68 ~StrongBinding() override {} 68 ~StrongBinding() override {}
69 69
70 void Bind(
71 ScopedMessagePipeHandle handle,
72 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
73 binding_.Bind(handle.Pass(), waiter);
jamesr 2014/11/19 20:57:17 add an assert() that we aren't already bound since
74 }
75
76 void Bind(
77 InterfacePtr<Interface>* ptr,
78 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
79 binding_.Bind(ptr, waiter);
80 }
81
82 void Bind(
83 InterfaceRequest<Interface> request,
84 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
85 binding_.Bind(request.Pass(), waiter);
86 }
87
70 bool WaitForIncomingMethodCall() { 88 bool WaitForIncomingMethodCall() {
71 return binding_.WaitForIncomingMethodCall(); 89 return binding_.WaitForIncomingMethodCall();
72 } 90 }
73 91
74 void set_error_handler(ErrorHandler* error_handler) { 92 void set_error_handler(ErrorHandler* error_handler) {
75 error_handler_ = error_handler; 93 error_handler_ = error_handler;
76 } 94 }
77 95
78 typename Interface::Client* client() { return binding_.client(); } 96 typename Interface::Client* client() { return binding_.client(); }
79 // Exposed for testing, should not generally be used. 97 // Exposed for testing, should not generally be used.
80 internal::Router* internal_router() { return binding_.internal_router(); } 98 internal::Router* internal_router() { return binding_.internal_router(); }
81 99
82 // ErrorHandler implementation 100 // ErrorHandler implementation
83 void OnConnectionError() override { 101 void OnConnectionError() override {
84 if (error_handler_) 102 if (error_handler_)
85 error_handler_->OnConnectionError(); 103 error_handler_->OnConnectionError();
86 delete binding_.impl(); 104 delete binding_.impl();
87 } 105 }
88 106
89 private: 107 private:
90 ErrorHandler* error_handler_ = nullptr; 108 ErrorHandler* error_handler_ = nullptr;
91 Binding<Interface> binding_; 109 Binding<Interface> binding_;
92 }; 110 };
93 111
94 } // namespace mojo 112 } // namespace mojo
95 113
96 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ 114 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/services/gles2/command_buffer_driver.h » ('j') | mojo/services/gles2/command_buffer_driver.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698