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

Side by Side Diff: mojo/public/cpp/bindings/tests/variant_test_util.h

Issue 1751563002: Mojo C++ bindings: support mapping mojo string to WTF::String. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync & rebase Created 4 years, 9 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_VARIANT_TEST_UTIL_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_VARIANT_TEST_UTIL_H_
7
8 #include <string.h>
9
10 #include "base/logging.h"
11 #include "mojo/public/cpp/bindings/interface_request.h"
12
13 namespace mojo {
14 namespace test {
15
16 // Converts a request of Interface1 to a request of Interface0. Interface0 and
17 // Interface1 are expected to be two variants of the same mojom interface.
18 // In real-world use cases, users shouldn't need to worry about this. Because it
19 // is rare to deal with two variants of the same interface in the same app.
20 template <typename Interface0, typename Interface1>
21 InterfaceRequest<Interface0> ConvertInterfaceRequest(
22 InterfaceRequest<Interface1> request) {
23 DCHECK_EQ(0, strcmp(Interface0::Name_, Interface1::Name_));
24 InterfaceRequest<Interface0> result;
25 result.Bind(request.PassMessagePipe());
26 return result;
27 }
28
29 } // namespace test
30 } // namespace mojo
31
32 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_VARIANT_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698