| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 StringResource_h | 5 #ifndef StringResource_h |
| 6 #define StringResource_h | 6 #define StringResource_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/wtf/Allocator.h" | 9 #include "platform/wtf/Allocator.h" |
| 10 #include "platform/wtf/Threading.h" | 10 #include "platform/wtf/Threading.h" |
| 11 #include "platform/wtf/text/AtomicString.h" | 11 #include "platform/wtf/text/AtomicString.h" |
| 12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 // StringResource is a helper class for V8ExternalString. It is used | 16 // StringResource is a helper class for V8ExternalString. It is used |
| 17 // to manage the life-cycle of the underlying buffer of the external string. | 17 // to manage the life-cycle of the underlying buffer of the external string. |
| 18 class StringResourceBase { | 18 class StringResourceBase { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 size_t length() const override { return plain_string_.Impl()->length(); } | 123 size_t length() const override { return plain_string_.Impl()->length(); } |
| 124 const char* data() const override { | 124 const char* data() const override { |
| 125 return reinterpret_cast<const char*>(plain_string_.Impl()->Characters8()); | 125 return reinterpret_cast<const char*>(plain_string_.Impl()->Characters8()); |
| 126 } | 126 } |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 enum ExternalMode { kExternalize, kDoNotExternalize }; | 129 enum ExternalMode { kExternalize, kDoNotExternalize }; |
| 130 | 130 |
| 131 template <typename StringType> | 131 template <typename StringType> |
| 132 CORE_EXPORT StringType V8StringToWebCoreString(v8::Local<v8::String>, | 132 PLATFORM_EXPORT StringType V8StringToWebCoreString(v8::Local<v8::String>, |
| 133 ExternalMode); | 133 ExternalMode); |
| 134 CORE_EXPORT String Int32ToWebCoreString(int value); | 134 PLATFORM_EXPORT String Int32ToWebCoreString(int value); |
| 135 | 135 |
| 136 } // namespace blink | 136 } // namespace blink |
| 137 | 137 |
| 138 #endif // StringResource_h | 138 #endif // StringResource_h |
| OLD | NEW |