Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / extensions / renderer / static_v8_external_ascii_string_resource.h
blobda026505b5344248e46a082bcb0e101a2aacef88
1 // Copyright 2014 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.
5 #ifndef EXTENSIONS_RENDERER_STATIC_V8_EXTERNAL_ASCII_STRING_RESOURCE_H_
6 #define EXTENSIONS_RENDERER_STATIC_V8_EXTERNAL_ASCII_STRING_RESOURCE_H_
8 #include "base/compiler_specific.h"
9 #include "base/strings/string_piece.h"
10 #include "v8/include/v8.h"
12 namespace extensions {
14 // A very simple implementation of v8::ExternalAsciiStringResource that just
15 // wraps a buffer. The buffer must outlive the v8 runtime instance this resource
16 // is used in.
17 class StaticV8ExternalAsciiStringResource
18 : public v8::String::ExternalAsciiStringResource {
19 public:
20 explicit StaticV8ExternalAsciiStringResource(const base::StringPiece& buffer);
21 virtual ~StaticV8ExternalAsciiStringResource();
23 virtual const char* data() const OVERRIDE;
24 virtual size_t length() const OVERRIDE;
26 private:
27 base::StringPiece buffer_;
30 } // namespace extensions
32 #endif // EXTENSIONS_RENDERER_STATIC_V8_EXTERNAL_ASCII_STRING_RESOURCE_H_