blob: 7a72b792b4b2ab6f5d7de27f2486eb5973bc85d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_RENDERER_EXTENSIONS_STATIC_V8_EXTERNAL_STRING_RESOURCE_H_
#define CHROME_RENDERER_EXTENSIONS_STATIC_V8_EXTERNAL_STRING_RESOURCE_H_
#pragma once
#include "base/compiler_specific.h"
#include "base/string_piece.h"
#include "v8/include/v8.h"
namespace base {
class StringPiece;
}
// A very simple implementation of v8::ExternalAsciiStringResource that just
// wraps a buffer. The buffer must outlive the v8 runtime instance this resource
// is used in.
class StaticV8ExternalAsciiStringResource
: public v8::String::ExternalAsciiStringResource {
public:
explicit StaticV8ExternalAsciiStringResource(const base::StringPiece& buffer);
virtual const char* data() const OVERRIDE;
virtual size_t length() const OVERRIDE;
private:
base::StringPiece buffer_;
};
#endif // CHROME_RENDERER_EXTENSIONS_STATIC_V8_EXTERNAL_STRING_RESOURCE_H_
|