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

Unified Diff: mojo/public/cpp/bindings/interface_request.h

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/lib/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/interface_request.h
diff --git a/mojo/public/cpp/bindings/interface_request.h b/mojo/public/cpp/bindings/interface_request.h
deleted file mode 100644
index 17233308beed01fb5fcad6242926b490900ceabe..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/bindings/interface_request.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
-
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-
-namespace mojo {
-
-// Used in methods that return instances of remote objects.
-template <typename Interface>
-class InterfaceRequest {
- MOJO_MOVE_ONLY_TYPE(InterfaceRequest)
- public:
- InterfaceRequest() {}
-
- InterfaceRequest(InterfaceRequest&& other) { handle_ = other.handle_.Pass(); }
- InterfaceRequest& operator=(InterfaceRequest&& other) {
- handle_ = other.handle_.Pass();
- return *this;
- }
-
- // Returns true if the request has yet to be completed.
- bool is_pending() const { return handle_.is_valid(); }
-
- void Bind(ScopedMessagePipeHandle handle) { handle_ = handle.Pass(); }
-
- ScopedMessagePipeHandle PassMessagePipe() { return handle_.Pass(); }
-
- private:
- ScopedMessagePipeHandle handle_;
-};
-
-template <typename Interface>
-InterfaceRequest<Interface> MakeRequest(ScopedMessagePipeHandle handle) {
- InterfaceRequest<Interface> request;
- request.Bind(handle.Pass());
- return request.Pass();
-}
-
-// Used to construct a request that synchronously binds an InterfacePtr<..>,
-// making it immediately usable upon return. The resulting request object may
-// then be later bound to an InterfaceImpl<..> via BindToRequest.
-//
-// Given the following interface:
-//
-// interface Foo {
-// CreateBar(Bar& bar);
-// }
-//
-// The caller of CreateBar would have code similar to the following:
-//
-// InterfacePtr<Foo> foo = ...;
-// InterfacePtr<Bar> bar;
-// foo->CreateBar(GetProxy(&bar));
-//
-// Upon return from CreateBar, |bar| is ready to have methods called on it.
-//
-template <typename Interface>
-InterfaceRequest<Interface> GetProxy(InterfacePtr<Interface>* ptr) {
- MessagePipe pipe;
- ptr->Bind(pipe.handle0.Pass());
- return MakeRequest<Interface>(pipe.handle1.Pass());
-}
-
-} // namespace mojo
-
-#endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/lib/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698