From a22998a223ecdcd926d152baea8a8703bcb57d61 Mon Sep 17 00:00:00 2001 From: "abarth@chromium.org" Date: Sun, 10 Nov 2013 05:00:50 +0000 Subject: This CL introduces a lightweight bindings system for V8 called gin Unlike the extensions V8 bindings, gin is based on ObjectTemplates rather than on evaluating script. Unlike the Blink V8 bindings, gin isn't tightly coupled to Blink. In fact, gin's only link-time dependency is V8. We plan to use gin to build the V8 bindings for Mojo (see https://codereview.chromium.org/59153005/ for an example of how they will be used). In the long term, gin could serve as a basis for both the Blink and the extension system bindings, but we don't have any immediate plans to pursue that use of this code. This code is largely inspired by a lightweight bindings system designed by Aaron Boodman. Review URL: https://codereview.chromium.org/67763002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234160 0039d316-1c4b-4281-b951-d872f2087c98 --- gin/per_isolate_data.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 gin/per_isolate_data.h (limited to 'gin/per_isolate_data.h') diff --git a/gin/per_isolate_data.h b/gin/per_isolate_data.h new file mode 100644 index 0000000..72467b8 --- /dev/null +++ b/gin/per_isolate_data.h @@ -0,0 +1,38 @@ +// Copyright 2013 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 GIN_PER_ISOLATE_DATA_H_ +#define GIN_PER_ISOLATE_DATA_H_ + +#include + +#include "base/basictypes.h" +#include "gin/wrapper_info.h" +#include "v8/include/v8.h" + +namespace gin { + +class PerIsolateData { + public: + explicit PerIsolateData(v8::Isolate* isolate); + ~PerIsolateData(); + + static PerIsolateData* From(v8::Isolate* isolate); + + void RegisterObjectTemplate(WrapperInfo* info, + v8::Local object_template); + + private: + typedef std::map< + WrapperInfo*, v8::Eternal > ObjectTemplateMap; + + v8::Isolate* isolate_; + ObjectTemplateMap object_templates_; + + DISALLOW_COPY_AND_ASSIGN(PerIsolateData); +}; + +} // namespace gin + +#endif // GIN_PER_ISOLATE_DATA_H_ -- cgit v1.1