• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_STRING_TRAITS_WTF_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_WTF_H_
7 
8 #include "mojo/public/cpp/bindings/lib/bindings_internal.h"
9 #include "mojo/public/cpp/bindings/string_traits.h"
10 #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
11 
12 namespace mojo {
13 
14 template <>
15 struct StringTraits<WTF::String> {
16   static bool IsNull(const WTF::String& input) { return input.IsNull(); }
17   static void SetToNull(WTF::String* output);
18 
19   static void* SetUpContext(const WTF::String& input);
20   static void TearDownContext(const WTF::String& input, void* context);
21 
22   static size_t GetSize(const WTF::String& input, void* context);
23 
24   static const char* GetData(const WTF::String& input, void* context);
25 
26   static bool Read(StringDataView input, WTF::String* output);
27 };
28 
29 }  // namespace mojo
30 
31 #endif  // MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_WTF_H_
32