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

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

Issue 1968623002: Mojo C++ bindings: expose public <struct>DataView and StringDataView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@25_totally_new
Patch Set: Created 4 years, 7 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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_STRING_TRAITS_WTF_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_WTF_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_WTF_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_WTF_H_
7 7
8 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" 8 #include "mojo/public/cpp/bindings/lib/bindings_internal.h"
9 #include "mojo/public/cpp/bindings/string_traits.h" 9 #include "mojo/public/cpp/bindings/string_traits.h"
10 #include "third_party/WebKit/Source/wtf/text/WTFString.h" 10 #include "third_party/WebKit/Source/wtf/text/WTFString.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 13
14 template <> 14 template <>
15 struct StringTraits<WTF::String> { 15 struct StringTraits<WTF::String> {
16 static bool IsNull(const WTF::String& input) { return input.isNull(); } 16 static bool IsNull(const WTF::String& input) { return input.isNull(); }
17 17
18 static void* SetUpContext(const WTF::String& input); 18 static void* SetUpContext(const WTF::String& input);
19 static void TearDownContext(const WTF::String& input, void* context); 19 static void TearDownContext(const WTF::String& input, void* context);
20 20
21 static size_t GetSize(const WTF::String& input, void* context); 21 static size_t GetSize(const WTF::String& input, void* context);
22 22
23 static const char* GetData(const WTF::String& input, void* context); 23 static const char* GetData(const WTF::String& input, void* context);
24 24
25 // TODO(yzshen): Use a public type, such as mojo::String::DataView, for 25 static bool Read(StringDataView input, WTF::String* output);
26 // |input|.
27 static bool Read(internal::String_Data* input, WTF::String* output);
28 }; 26 };
29 27
30 } // namespace mojo 28 } // namespace mojo
31 29
32 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_WTF_H_ 30 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_WTF_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/string_traits_string_piece.h ('k') | mojo/public/tools/bindings/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698