Import Cobalt 14.119169
Change-Id: I3dabd6dd8bc7397e38771542aea50f2f57c0a000
diff --git a/src/base/base.gyp b/src/base/base.gyp
index 56a0c9a..6b048fc 100644
--- a/src/base/base.gyp
+++ b/src/base/base.gyp
@@ -183,7 +183,6 @@
'containers/mru_cache_unittest.cc',
'containers/small_map_unittest.cc',
'containers/stack_container_unittest.cc',
- 'cpu_unittest.cc',
'debug/leak_tracker_unittest.cc',
'debug/stack_trace_unittest.cc',
'debug/trace_event_unittest.cc',
diff --git a/src/base/base.gypi b/src/base/base.gypi
index fe57218..e5c56ef 100644
--- a/src/base/base.gypi
+++ b/src/base/base.gypi
@@ -54,8 +54,6 @@
'containers/mru_cache.h',
'containers/small_map.h',
'containers/stack_container.h',
- 'cpu.cc',
- 'cpu.h',
'critical_closure.h',
'debug/alias.cc',
'debug/alias.h',
diff --git a/src/base/cpu.cc b/src/base/cpu.cc
deleted file mode 100644
index cf4f2f1..0000000
--- a/src/base/cpu.cc
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include "base/cpu.h"
-
-#include <string.h>
-
-#include <algorithm>
-
-#include "build/build_config.h"
-
-#if defined(ARCH_CPU_X86_FAMILY)
-#if defined(_MSC_VER)
-#include <intrin.h>
-#endif
-#endif
-
-namespace base {
-
-CPU::CPU()
- : type_(0),
- family_(0),
- model_(0),
- stepping_(0),
- ext_model_(0),
- ext_family_(0),
- has_mmx_(false),
- has_sse_(false),
- has_sse2_(false),
- has_sse3_(false),
- has_ssse3_(false),
- has_sse41_(false),
- has_sse42_(false),
- cpu_vendor_("unknown") {
- Initialize();
-}
-
-#if defined(ARCH_CPU_X86_FAMILY)
-#ifndef _MSC_VER
-
-#if defined(__pic__) && defined(__i386__)
-
-void __cpuid(int cpu_info[4], int info_type) {
- __asm__ volatile (
- "mov %%ebx, %%edi\n"
- "cpuid\n"
- "xchg %%edi, %%ebx\n"
- : "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
- : "a"(info_type)
- );
-}
-
-void __cpuidex(int cpu_info[4], int info_type, int info_index) {
- __asm__ volatile (
- "mov %%ebx, %%edi\n"
- "cpuid\n"
- "xchg %%edi, %%ebx\n"
- : "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
- : "a"(info_type), "c"(info_index)
- );
-}
-
-#else
-
-void __cpuid(int cpu_info[4], int info_type) {
- __asm__ volatile (
- "cpuid \n\t"
- : "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
- : "a"(info_type)
- );
-}
-
-void __cpuidex(int cpu_info[4], int info_type, int info_index) {
- __asm__ volatile (
- "cpuid \n\t"
- : "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
- : "a"(info_type), "c"(info_index)
- );
-}
-
-#endif
-#endif // _MSC_VER
-#endif // ARCH_CPU_X86_FAMILY
-
-void CPU::Initialize() {
-#if defined(ARCH_CPU_X86_FAMILY)
- int cpu_info[4] = {-1};
- char cpu_string[48];
-
- // __cpuid with an InfoType argument of 0 returns the number of
- // valid Ids in CPUInfo[0] and the CPU identification string in
- // the other three array elements. The CPU identification string is
- // not in linear order. The code below arranges the information
- // in a human readable form. The human readable order is CPUInfo[1] |
- // CPUInfo[3] | CPUInfo[2]. CPUInfo[2] and CPUInfo[3] are swapped
- // before using memcpy to copy these three array elements to cpu_string.
- __cpuid(cpu_info, 0);
- int num_ids = cpu_info[0];
- std::swap(cpu_info[2], cpu_info[3]);
- memcpy(cpu_string, &cpu_info[1], 3 * sizeof(cpu_info[1]));
- cpu_vendor_.assign(cpu_string, 3 * sizeof(cpu_info[1]));
-
- // Interpret CPU feature information.
- if (num_ids > 0) {
- __cpuid(cpu_info, 1);
- stepping_ = cpu_info[0] & 0xf;
- model_ = ((cpu_info[0] >> 4) & 0xf) + ((cpu_info[0] >> 12) & 0xf0);
- family_ = (cpu_info[0] >> 8) & 0xf;
- type_ = (cpu_info[0] >> 12) & 0x3;
- ext_model_ = (cpu_info[0] >> 16) & 0xf;
- ext_family_ = (cpu_info[0] >> 20) & 0xff;
- has_mmx_ = (cpu_info[3] & 0x00800000) != 0;
- has_sse_ = (cpu_info[3] & 0x02000000) != 0;
- has_sse2_ = (cpu_info[3] & 0x04000000) != 0;
- has_sse3_ = (cpu_info[2] & 0x00000001) != 0;
- has_ssse3_ = (cpu_info[2] & 0x00000200) != 0;
- has_sse41_ = (cpu_info[2] & 0x00080000) != 0;
- has_sse42_ = (cpu_info[2] & 0x00100000) != 0;
- }
-
- // Get the brand string of the cpu.
- __cpuid(cpu_info, 0x80000000);
- const int parameter_end = 0x80000004;
-
- if (cpu_info[0] >= parameter_end) {
- char* cpu_string_ptr = cpu_string;
-
- for (int parameter = 0x80000002; parameter <= parameter_end &&
- cpu_string_ptr < &cpu_string[sizeof(cpu_string)]; parameter++) {
- __cpuid(cpu_info, parameter);
- memcpy(cpu_string_ptr, cpu_info, sizeof(cpu_info));
- cpu_string_ptr += sizeof(cpu_info);
- }
- cpu_brand_.assign(cpu_string, cpu_string_ptr - cpu_string);
- }
-#endif
-}
-
-} // namespace base
diff --git a/src/base/cpu.h b/src/base/cpu.h
deleted file mode 100644
index 957b1a5..0000000
--- a/src/base/cpu.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2012 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 BASE_CPU_H_
-#define BASE_CPU_H_
-
-#include <string>
-
-#include "base/base_export.h"
-
-namespace base {
-
-// Query information about the processor.
-class BASE_EXPORT CPU {
- public:
- // Constructor
- CPU();
-
- // Accessors for CPU information.
- const std::string& vendor_name() const { return cpu_vendor_; }
- int stepping() const { return stepping_; }
- int model() const { return model_; }
- int family() const { return family_; }
- int type() const { return type_; }
- int extended_model() const { return ext_model_; }
- int extended_family() const { return ext_family_; }
- bool has_mmx() const { return has_mmx_; }
- bool has_sse() const { return has_sse_; }
- bool has_sse2() const { return has_sse2_; }
- bool has_sse3() const { return has_sse3_; }
- bool has_ssse3() const { return has_ssse3_; }
- bool has_sse41() const { return has_sse41_; }
- bool has_sse42() const { return has_sse42_; }
- const std::string& cpu_brand() const { return cpu_brand_; }
-
- private:
- // Query the processor for CPUID information.
- void Initialize();
-
- int type_; // process type
- int family_; // family of the processor
- int model_; // model of processor
- int stepping_; // processor revision number
- int ext_model_;
- int ext_family_;
- bool has_mmx_;
- bool has_sse_;
- bool has_sse2_;
- bool has_sse3_;
- bool has_ssse3_;
- bool has_sse41_;
- bool has_sse42_;
- std::string cpu_vendor_;
- std::string cpu_brand_;
-};
-
-} // namespace base
-
-#endif // BASE_CPU_H_
diff --git a/src/base/cpu_unittest.cc b/src/base/cpu_unittest.cc
deleted file mode 100644
index d059dee..0000000
--- a/src/base/cpu_unittest.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include "base/cpu.h"
-#include "build/build_config.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-// Tests whether we can run extended instructions represented by the CPU
-// information. This test actually executes some extended instructions (such as
-// MMX, SSE, etc.) supported by the CPU and sees we can run them without
-// "undefined instruction" exceptions. That is, this test succeeds when this
-// test finishes without a crash.
-TEST(CPU, RunExtendedInstructions) {
-#if defined(ARCH_CPU_X86_FAMILY)
- // Retrieve the CPU information.
- base::CPU cpu;
-
-#if defined(OS_WIN)
- ASSERT_TRUE(cpu.has_mmx());
-
- // Execute an MMX instruction.
- __asm emms;
-
- if (cpu.has_sse()) {
- // Execute an SSE instruction.
- __asm xorps xmm0, xmm0;
- }
-
- if (cpu.has_sse2()) {
- // Execute an SSE 2 instruction.
- __asm psrldq xmm0, 0;
- }
-
- if (cpu.has_sse3()) {
- // Execute an SSE 3 instruction.
- __asm addsubpd xmm0, xmm0;
- }
-
- if (cpu.has_ssse3()) {
- // Execute a Supplimental SSE 3 instruction.
- __asm psignb xmm0, xmm0;
- }
-
- if (cpu.has_sse41()) {
- // Execute an SSE 4.1 instruction.
- __asm pmuldq xmm0, xmm0;
- }
-
- if (cpu.has_sse42()) {
- // Execute an SSE 4.2 instruction.
- __asm crc32 eax, eax;
- }
-#elif defined(OS_POSIX) && defined(__x86_64__)
- ASSERT_TRUE(cpu.has_mmx());
-
- // Execute an MMX instruction.
- __asm__ __volatile__("emms\n" : : : "mm0");
-
- if (cpu.has_sse()) {
- // Execute an SSE instruction.
- __asm__ __volatile__("xorps %%xmm0, %%xmm0\n" : : : "xmm0");
- }
-
- if (cpu.has_sse2()) {
- // Execute an SSE 2 instruction.
- __asm__ __volatile__("psrldq $0, %%xmm0\n" : : : "xmm0");
- }
-
- if (cpu.has_sse3()) {
- // Execute an SSE 3 instruction.
- __asm__ __volatile__("addsubpd %%xmm0, %%xmm0\n" : : : "xmm0");
- }
-
- if (cpu.has_ssse3()) {
- // Execute a Supplimental SSE 3 instruction.
- __asm__ __volatile__("psignb %%xmm0, %%xmm0\n" : : : "xmm0");
- }
-
- if (cpu.has_sse41()) {
- // Execute an SSE 4.1 instruction.
- __asm__ __volatile__("pmuldq %%xmm0, %%xmm0\n" : : : "xmm0");
- }
-
- if (cpu.has_sse42()) {
- // Execute an SSE 4.2 instruction.
- __asm__ __volatile__("crc32 %%eax, %%eax\n" : : : "eax");
- }
-#endif
-#endif
-}
diff --git a/src/base/file_path.cc b/src/base/file_path.cc
index 4715417..f62acae 100644
--- a/src/base/file_path.cc
+++ b/src/base/file_path.cc
@@ -44,14 +44,6 @@
namespace {
-#if defined(FILE_PATH_USES_WIN_SEPARATORS) && defined(OS_POSIX)
-inline bool StartsWith(const std::string& str,
- const std::string& search,
- bool case_sensitive) {
- return StartsWithASCII(str, search, case_sensitive);
-}
-#endif
-
const char* kCommonDoubleExtensionSuffixes[] = { "gz", "z", "bz2" };
const char* kCommonDoubleExtensions[] = { "user.js" };
diff --git a/src/base/file_util_starboard.cc b/src/base/file_util_starboard.cc
index a2e9b2b..0856c69 100644
--- a/src/base/file_util_starboard.cc
+++ b/src/base/file_util_starboard.cc
@@ -39,7 +39,7 @@
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
- "._-"
+ "_-"
};
const int kPortableFilenameCharactersLength =
SB_ARRAY_SIZE_INT(kPortableFilenameCharacters) - 1;
diff --git a/src/base/string_util.h b/src/base/string_util.h
index 84831d0..9290bee 100644
--- a/src/base/string_util.h
+++ b/src/base/string_util.h
@@ -371,6 +371,15 @@
const string16& search,
bool case_sensitive);
+// Generic version.
+template <typename StringType>
+inline bool StartsWith(const StringType& str, const StringType& search,
+ bool case_sensitive) {
+ std::wstring str_16(str.begin(), str.end());
+ std::wstring search_16(search.begin(), search.end());
+ return StartsWith(str_16, search_16, case_sensitive);
+}
+
// Returns true if str ends with search, or false otherwise.
BASE_EXPORT bool EndsWith(const std::string& str,
const std::string& search,
diff --git a/src/base/sys_info.h b/src/base/sys_info.h
index e653590..c5415e0 100644
--- a/src/base/sys_info.h
+++ b/src/base/sys_info.h
@@ -67,8 +67,6 @@
// whereas a x86-64 kernel on the same CPU will return "x86_64"
static std::string OperatingSystemArchitecture();
- // Avoid using this. Use base/cpu.h to get information about the CPU instead.
- // http://crbug.com/148884
// Returns the CPU model name of the system. If it can not be figured out,
// an empty string is returned.
static std::string CPUModelName();
diff --git a/src/base/test/test_suite.cc b/src/base/test/test_suite.cc
index 40d4071..6e0444d 100644
--- a/src/base/test/test_suite.cc
+++ b/src/base/test/test_suite.cc
@@ -32,10 +32,6 @@
#endif // OS_IOS
#endif // OS_MACOSX
-#if defined(OS_STARBOARD)
-#include "starboard/system.h"
-#endif
-
#if defined(OS_ANDROID) || defined(__LB_ANDROID__)
#include "base/test/test_support_android.h"
#endif
@@ -103,11 +99,6 @@
#if defined(OS_WIN)
testing::GTEST_FLAG(catch_exceptions) = false;
#endif
-
-#if defined(OS_STARBOARD)
- testing::GTEST_FLAG(break_on_failure) = SbSystemIsDebuggerAttached();
-#endif
-
base::EnableTerminationOnHeapCorruption();
initialized_command_line_ = CommandLine::Init(argc, argv);
testing::InitGoogleTest(&argc, argv);
diff --git a/src/cobalt/accessibility/screen_reader_tests.cc b/src/cobalt/accessibility/screen_reader_tests.cc
index 611d7ed..9974b6b 100644
--- a/src/cobalt/accessibility/screen_reader_tests.cc
+++ b/src/cobalt/accessibility/screen_reader_tests.cc
@@ -26,7 +26,9 @@
#include "cobalt/accessibility/tts_engine.h"
#include "cobalt/browser/web_module.h"
#include "cobalt/dom/element.h"
+#include "cobalt/dom/window.h"
#include "cobalt/test/document_loader.h"
+#include "starboard/window.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -127,6 +129,10 @@
base::WaitableEvent quit_event_;
scoped_ptr<accessibility::ScreenReader> screen_reader_;
};
+
+// Return a NULL SbWindow, since we do not need to pass a valid SbWindow to an
+// on screen keyboard.
+SbWindow GetNullSbWindow() { return NULL; }
} // namespace
TEST_P(TextAlternativeTest, TextAlternativeTest) {
@@ -173,9 +179,10 @@
base::Bind(&LiveRegionMutationTest::OnError, base::Unretained(this)),
base::Bind(&LiveRegionMutationTest::OnClose, base::Unretained(this)),
base::Closure(), /* window_minimize_callback */
- NULL /* can_play_type_handler */, NULL /* web_media_player_factory */,
- &network_module, kDefaultViewportSize, kDefaultVideoPixelRatio,
- &resource_provider, kRefreshRate, web_module_options);
+ base::Bind(&GetNullSbWindow), NULL /* can_play_type_handler */,
+ NULL /* web_media_player_factory */, &network_module,
+ kDefaultViewportSize, kDefaultVideoPixelRatio, &resource_provider,
+ kRefreshRate, web_module_options);
// Wait for the test to quit.
quit_event_.Wait();
diff --git a/src/cobalt/base/base.gyp b/src/cobalt/base/base.gyp
index ee51357..2f25385 100644
--- a/src/cobalt/base/base.gyp
+++ b/src/cobalt/base/base.gyp
@@ -53,6 +53,8 @@
'log_message_handler.h',
'math.h',
'message_queue.h',
+ 'on_screen_keyboard_hidden_event.h',
+ 'on_screen_keyboard_shown_event.h',
'path_provider.cc',
'path_provider.h',
'poller.h',
diff --git a/src/cobalt/base/language.cc b/src/cobalt/base/language.cc
index 93869a1..fc72003 100644
--- a/src/cobalt/base/language.cc
+++ b/src/cobalt/base/language.cc
@@ -14,6 +14,8 @@
#include "cobalt/base/language.h"
+#include <algorithm>
+
#include "base/basictypes.h"
#include "base/logging.h"
#include "third_party/icu/source/common/unicode/uloc.h"
@@ -42,4 +44,28 @@
// We should end up with something like "en" or "en-US".
return language;
}
+
+std::string GetSystemLanguageScript() {
+ char buffer[ULOC_LANG_CAPACITY];
+ UErrorCode icu_result = U_ZERO_ERROR;
+
+ // Combine the ISO language and script.
+ uloc_getLanguage(NULL, buffer, arraysize(buffer), &icu_result);
+ if (!U_SUCCESS(icu_result)) {
+ DLOG(FATAL) << __FUNCTION__ << ": Unable to get language from ICU for "
+ << "default locale " << uloc_getDefault() << ".";
+ return "en";
+ }
+
+ std::string language = buffer;
+ uloc_getScript(NULL, buffer, arraysize(buffer), &icu_result);
+ if (U_SUCCESS(icu_result) && buffer[0]) {
+ language += "-";
+ language += buffer;
+ }
+
+ // We should end up with something like "en" or "en-Latn".
+ return language;
+}
+
} // namespace base
diff --git a/src/cobalt/base/language.h b/src/cobalt/base/language.h
index 174035f..4e59a72 100644
--- a/src/cobalt/base/language.h
+++ b/src/cobalt/base/language.h
@@ -19,12 +19,18 @@
namespace base {
-// Gets the system language.
+// Gets the system language and ISO 3166-1 country code.
// NOTE: should be in the format described by bcp47.
// http://www.rfc-editor.org/rfc/bcp/bcp47.txt
// Example: "en-US" or "de"
std::string GetSystemLanguage();
+// Gets the system language and ISO 15924 script code.
+// NOTE: should be in the format described by bcp47.
+// http://www.rfc-editor.org/rfc/bcp/bcp47.txt
+// Example: "en-US" or "de"
+std::string GetSystemLanguageScript();
+
} // namespace base
#endif // COBALT_BASE_LANGUAGE_H_
diff --git a/src/cobalt/base/on_screen_keyboard_hidden_event.h b/src/cobalt/base/on_screen_keyboard_hidden_event.h
new file mode 100644
index 0000000..81539a9
--- /dev/null
+++ b/src/cobalt/base/on_screen_keyboard_hidden_event.h
@@ -0,0 +1,32 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef COBALT_BASE_ON_SCREEN_KEYBOARD_HIDDEN_EVENT_H_
+#define COBALT_BASE_ON_SCREEN_KEYBOARD_HIDDEN_EVENT_H_
+
+#include "cobalt/base/event.h"
+#include "starboard/event.h"
+
+namespace base {
+
+class OnScreenKeyboardHiddenEvent : public Event {
+ public:
+ OnScreenKeyboardHiddenEvent() {}
+
+ BASE_EVENT_SUBCLASS(OnScreenKeyboardHiddenEvent);
+};
+
+} // namespace base
+
+#endif // COBALT_BASE_ON_SCREEN_KEYBOARD_HIDDEN_EVENT_H_
diff --git a/src/cobalt/base/on_screen_keyboard_shown_event.h b/src/cobalt/base/on_screen_keyboard_shown_event.h
new file mode 100644
index 0000000..b48f76a
--- /dev/null
+++ b/src/cobalt/base/on_screen_keyboard_shown_event.h
@@ -0,0 +1,32 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef COBALT_BASE_ON_SCREEN_KEYBOARD_SHOWN_EVENT_H_
+#define COBALT_BASE_ON_SCREEN_KEYBOARD_SHOWN_EVENT_H_
+
+#include "cobalt/base/event.h"
+#include "starboard/event.h"
+
+namespace base {
+
+class OnScreenKeyboardShownEvent : public Event {
+ public:
+ OnScreenKeyboardShownEvent() {}
+
+ BASE_EVENT_SUBCLASS(OnScreenKeyboardShownEvent);
+};
+
+} // namespace base
+
+#endif // COBALT_BASE_ON_SCREEN_KEYBOARD_SHOWN_EVENT_H_
diff --git a/src/cobalt/base/tokens.h b/src/cobalt/base/tokens.h
index 891c4a6..758a2d2 100644
--- a/src/cobalt/base/tokens.h
+++ b/src/cobalt/base/tokens.h
@@ -64,6 +64,8 @@
MacroOpWithNameOnly(focusout) \
MacroOpWithNameOnly(gotpointercapture) \
MacroOpWithNameOnly(hashchange) \
+ MacroOpWithNameOnly(hide) \
+ MacroOpWithNameOnly(input) \
MacroOpWithNameOnly(keydown) \
MacroOpWithNameOnly(keypress) \
MacroOpWithNameOnly(keystatuseschange) \
@@ -109,6 +111,7 @@
MacroOpWithNameOnly(securitypolicyviolation) \
MacroOpWithNameOnly(seeked) \
MacroOpWithNameOnly(seeking) \
+ MacroOpWithNameOnly(show) \
MacroOpWithNameOnly(soundend) \
MacroOpWithNameOnly(soundstart) \
MacroOpWithNameOnly(sourceclose) \
diff --git a/src/cobalt/base/window_size_changed_event.h b/src/cobalt/base/window_size_changed_event.h
index 50034c8..0fbaa8d 100644
--- a/src/cobalt/base/window_size_changed_event.h
+++ b/src/cobalt/base/window_size_changed_event.h
@@ -17,6 +17,7 @@
#include "cobalt/base/event.h"
#include "starboard/event.h"
+#include "starboard/window.h"
namespace base {
diff --git a/src/cobalt/bindings/contexts.py b/src/cobalt/bindings/contexts.py
index 4bebf81..f1b9381 100644
--- a/src/cobalt/bindings/contexts.py
+++ b/src/cobalt/bindings/contexts.py
@@ -194,6 +194,9 @@
if extended_attributes.has_key('Clamp'):
flags.append('kConversionFlagClamped')
+ if is_object_type(idl_type):
+ flags.append('kConversionFlagObjectOnly')
+
if flags:
return '(%s)' % ' | '.join(flags)
else:
@@ -264,7 +267,7 @@
elif idl_type.name == 'void':
cobalt_type = 'void'
elif is_object_type(idl_type):
- cobalt_type = '::cobalt::script::OpaqueHandle'
+ cobalt_type = '::cobalt::script::ValueHandle'
elif is_any_type(idl_type):
cobalt_type = '::cobalt::script::ValueHandle'
elif idl_type.is_dictionary:
@@ -545,7 +548,8 @@
# Get the method contexts for all operations.
methods = [
self.method_context(interface, operation)
- for operation in interface.operations if operation.name
+ for operation in interface.operations
+ if operation.name
]
# Create overload sets for static and non-static methods seperately.
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_indexed_getter_interface.cc
index 6f7ac05..8d8e5b6 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_indexed_getter_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsAnonymousIndexedGetterInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -501,3 +501,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_getter_interface.cc
index 99c1120..f058a0f 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_getter_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsAnonymousNamedGetterInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -449,3 +449,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_indexed_getter_interface.cc
index 9afcce7..5bae384 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_indexed_getter_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsAnonymousNamedIndexedGetterInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -598,3 +598,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
index de68231..b873842 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsArbitraryInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -529,3 +529,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_base_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_base_interface.cc
index 954072a..3277ead 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_base_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_base_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsBaseInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -477,3 +477,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
index 64e9741..35f47c0 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsBooleanTypeTestInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -580,3 +580,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
index 3cf816e..129215d 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/arbitrary_interface.h"
#include "cobalt/bindings/testing/mozjs_arbitrary_interface.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -57,10 +56,10 @@
using cobalt::bindings::testing::MozjsArbitraryInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -84,6 +83,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -903,3 +903,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
index 657efc9..ff95770 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/mozjs_single_operation_interface.h"
#include "cobalt/bindings/testing/single_operation_interface.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -57,10 +56,10 @@
using cobalt::bindings::testing::SingleOperationInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -84,6 +83,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -578,3 +578,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
index ae18a41..5149de4 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
@@ -24,8 +24,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -55,10 +54,10 @@
using cobalt::bindings::testing::MozjsConditionalInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -82,6 +81,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -684,4 +684,6 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
#endif // defined(ENABLE_CONDITIONAL_INTERFACE)
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constants_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constants_interface.cc
index cd9cc40..eb073de 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constants_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constants_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsConstantsInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -419,3 +419,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_interface.cc
index eb15fb1..59b6267 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsConstructorInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -437,3 +437,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_with_arguments_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_with_arguments_interface.cc
index 416a407..6d4747e 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_with_arguments_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_with_arguments_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsConstructorWithArgumentsInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -582,3 +582,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
index c6eb535..4e37f83 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/mozjs_named_indexed_getter_interface.h"
#include "cobalt/bindings/testing/named_indexed_getter_interface.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -57,10 +56,10 @@
using cobalt::bindings::testing::NamedIndexedGetterInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -84,6 +83,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -909,3 +909,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
index 3e5b114..6f9fb06 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/base_interface.h"
#include "cobalt/bindings/testing/mozjs_base_interface.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -57,10 +56,10 @@
using cobalt::bindings::testing::MozjsBaseInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -84,6 +83,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -481,3 +481,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
index 85aa292..8a170b0 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/derived_dictionary.h"
#include "cobalt/bindings/testing/dictionary_with_dictionary_member.h"
#include "cobalt/bindings/testing/test_dictionary.h"
@@ -37,7 +37,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -59,10 +58,10 @@
using cobalt::bindings::testing::TestDictionary;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -86,6 +85,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -665,3 +665,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
index 0a829bb..6d32fdc 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
@@ -24,8 +24,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -55,10 +54,10 @@
using cobalt::bindings::testing::MozjsDisabledInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -82,6 +81,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -509,4 +509,6 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
#endif // defined(NO_ENABLE_CONDITIONAL_INTERFACE)
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dom_string_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dom_string_test_interface.cc
index 2f4b7f8..8958824 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dom_string_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dom_string_test_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsDOMStringTestInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -884,3 +884,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
index fb1bbf3..d8c8ddf 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/test_enum.h"
#include "mozjs_gen_type_conversion.h"
@@ -35,7 +35,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -55,10 +54,10 @@
using cobalt::bindings::testing::TestEnum;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -82,6 +81,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -547,3 +547,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exception_object_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exception_object_interface.cc
index f826cee..5d41a65 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exception_object_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exception_object_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -54,10 +53,10 @@
using cobalt::bindings::testing::MozjsExceptionObjectInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -81,6 +80,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -464,3 +464,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
index c68f5b0..ae894b0 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsExceptionsInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -533,3 +533,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
index 0bb6b92..1e0ef66 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsExtendedIDLAttributesInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -576,3 +576,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_garbage_collection_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_garbage_collection_test_interface.cc
index 516292d..bc23f28 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_garbage_collection_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_garbage_collection_test_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/garbage_collection_test_interface.h"
#include "cobalt/bindings/testing/mozjs_garbage_collection_test_interface.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -57,10 +56,10 @@
using cobalt::bindings::testing::MozjsGarbageCollectionTestInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -84,6 +83,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -590,3 +590,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
index aae9abc..bd1c4f6 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsGlobalInterfaceParent;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -401,3 +401,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
index 3dbdd6f..77a6cac 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsIndexedGetterInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -735,3 +735,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
index 9251dee..941f391 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsInterfaceWithAny;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -496,3 +496,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any_dictionary.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any_dictionary.cc
index 72f9597..7c1d349 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any_dictionary.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any_dictionary.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsInterfaceWithAnyDictionary;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -606,3 +606,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_unsupported_properties.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_unsupported_properties.cc
index 1e9f8a3..69406e6 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_unsupported_properties.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_unsupported_properties.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsInterfaceWithUnsupportedProperties;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -406,3 +406,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_constructor_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_constructor_interface.cc
index a045a97..e1f0dd7 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_constructor_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_constructor_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsNamedConstructorInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -374,3 +374,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
index 0ab91ae..1ebe67d 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsNamedGetterInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -683,3 +683,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
index d306f6c..fe2a9a0 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsNamedIndexedGetterInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -1057,3 +1057,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nested_put_forwards_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nested_put_forwards_interface.cc
index 1873dba..55d4725 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nested_put_forwards_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nested_put_forwards_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/mozjs_put_forwards_interface.h"
#include "cobalt/bindings/testing/put_forwards_interface.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -57,10 +56,10 @@
using cobalt::bindings::testing::PutForwardsInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -84,6 +83,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -484,3 +484,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_constructor_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_constructor_interface.cc
index 242d0db..c02f954 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_constructor_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_constructor_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsNoConstructorInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -352,3 +352,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_interface_object_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_interface_object_interface.cc
index ef77f03..354cf74 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_interface_object_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_interface_object_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsNoInterfaceObjectInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -301,3 +301,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
index 9608bc5..6b1d665 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/arbitrary_interface.h"
#include "cobalt/bindings/testing/mozjs_arbitrary_interface.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -57,10 +56,10 @@
using cobalt::bindings::testing::MozjsArbitraryInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -84,6 +83,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -1268,3 +1268,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
index c366032..561aeaa 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsNumericTypesTestInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -3480,3 +3480,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_object_type_bindings_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_object_type_bindings_interface.cc
index 9ab8de4..b800056 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_object_type_bindings_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_object_type_bindings_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/arbitrary_interface.h"
#include "cobalt/bindings/testing/base_interface.h"
#include "cobalt/bindings/testing/derived_interface.h"
@@ -40,7 +40,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -65,10 +64,10 @@
using cobalt::bindings::testing::MozjsDerivedInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -92,6 +91,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -521,12 +521,12 @@
WrapperPrivate::GetFromObject(context, object);
ObjectTypeBindingsInterface* impl =
wrapper_private->wrappable<ObjectTypeBindingsInterface>().get();
- TypeTraits<::cobalt::script::OpaqueHandle >::ConversionType value;
+ TypeTraits<::cobalt::script::ValueHandle >::ConversionType value;
if (args.length() != 1) {
NOTREACHED();
return false;
}
- FromJSValue(context, args[0], (kConversionFlagNullable), &exception_state,
+ FromJSValue(context, args[0], (kConversionFlagNullable | kConversionFlagObjectOnly), &exception_state,
&value);
if (exception_state.is_exception_set()) {
return false;
@@ -736,3 +736,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
index f8e366d..607f7e8 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/arbitrary_interface.h"
#include "cobalt/bindings/testing/mozjs_arbitrary_interface.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -57,10 +56,10 @@
using cobalt::bindings::testing::MozjsArbitraryInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -84,6 +83,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -1904,3 +1904,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_promise_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
index 593cefe..c720acf 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsPromiseInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -621,3 +621,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_put_forwards_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_put_forwards_interface.cc
index c7ae942..f3ffe60 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_put_forwards_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_put_forwards_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/arbitrary_interface.h"
#include "cobalt/bindings/testing/mozjs_arbitrary_interface.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -57,10 +56,10 @@
using cobalt::bindings::testing::MozjsArbitraryInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -84,6 +83,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -543,3 +543,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_sequence_user.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
index 7416868..81f0938 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/arbitrary_interface.h"
#include "cobalt/bindings/testing/mozjs_arbitrary_interface.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -57,10 +56,10 @@
using cobalt::bindings::testing::MozjsArbitraryInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -84,6 +83,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -1232,3 +1232,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
index 6f5cd15..c12d824 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
@@ -51,12 +51,6 @@
MozjsSingleOperationInterface::MozjsSingleOperationInterface(
JSContext* context,
- JS::HandleObject implementing_object)
- : context_(context),
- implementing_object_(context, implementing_object) { }
-
-MozjsSingleOperationInterface::MozjsSingleOperationInterface(
- JSContext* context,
JS::HandleValue implementing_object_value)
: context_(context),
implementing_object_(context, implementing_object_value) { }
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.h b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.h
index 9338c40..9be2024 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.h
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.h
@@ -36,8 +36,6 @@
typedef SingleOperationInterface BaseType;
MozjsSingleOperationInterface(
- JSContext* context, JS::HandleObject implementing_object);
- MozjsSingleOperationInterface(
JSContext* context, JS::HandleValue implementing_object_value);
base::optional<int32_t > HandleCallback(
const scoped_refptr<script::Wrappable>& callback_this,
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_static_properties_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_static_properties_interface.cc
index b8b9c56..2dabdcc 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_static_properties_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_static_properties_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/arbitrary_interface.h"
#include "cobalt/bindings/testing/mozjs_arbitrary_interface.h"
@@ -36,7 +36,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -57,10 +56,10 @@
using cobalt::bindings::testing::MozjsArbitraryInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -84,6 +83,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -668,3 +668,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
index 13b3bcf..8992fff 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsStringifierAnonymousOperationInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -413,3 +413,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
index 78d93ea..4cfb373 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsStringifierAttributeInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -519,3 +519,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
index 14a2c07..c537e6e 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsStringifierOperationInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -468,3 +468,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_target_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_target_interface.cc
index 1ebf396..7b49c6e 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_target_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_target_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "mozjs_gen_type_conversion.h"
@@ -34,7 +34,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -53,10 +52,10 @@
using cobalt::bindings::testing::MozjsTargetInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -80,6 +79,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -450,3 +450,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_union_types_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_union_types_interface.cc
index 2a312fd..7a46163 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_union_types_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_union_types_interface.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/arbitrary_interface.h"
#include "cobalt/bindings/testing/base_interface.h"
#include "cobalt/bindings/testing/mozjs_arbitrary_interface.h"
@@ -38,7 +38,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -61,10 +60,10 @@
using cobalt::bindings::testing::MozjsBaseInterface;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -88,6 +87,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
} // namespace
@@ -784,3 +784,5 @@
} // namespace testing
} // namespace bindings
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_window.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_window.cc
index 0118eab..c31604c 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_window.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_window.cc
@@ -22,8 +22,8 @@
#include "base/debug/trace_event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/script/global_environment.h"
-#include "cobalt/script/opaque_handle.h"
#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
#include "cobalt/bindings/testing/anonymous_indexed_getter_interface.h"
#include "cobalt/bindings/testing/anonymous_named_getter_interface.h"
#include "cobalt/bindings/testing/anonymous_named_indexed_getter_interface.h"
@@ -132,7 +132,6 @@
#include "cobalt/script/mozjs-45/mozjs_callback_function.h"
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_global_environment.h"
-#include "cobalt/script/mozjs-45/mozjs_object_handle.h"
#include "cobalt/script/mozjs-45/mozjs_property_enumerator.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
@@ -257,10 +256,10 @@
using cobalt::bindings::testing::Window;
using cobalt::script::CallbackInterfaceTraits;
using cobalt::script::GlobalEnvironment;
-using cobalt::script::OpaqueHandle;
-using cobalt::script::OpaqueHandleHolder;
using cobalt::script::ScriptValue;
using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
using cobalt::script::Wrappable;
using cobalt::script::CallbackFunction;
@@ -284,6 +283,7 @@
using cobalt::script::mozjs::kConversionFlagRestricted;
using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::mozjs::kConversionFlagObjectOnly;
using cobalt::script::mozjs::kNoConversionFlags;
JSObject* DummyFunctor(
JSContext* context, const scoped_refptr<Wrappable>& wrappable) {
@@ -1062,223 +1062,233 @@
} // namespace bindings
} // namespace cobalt
+
namespace cobalt {
namespace script {
+namespace mozjs {
-template<>
-void GlobalEnvironment::CreateGlobalObject<Window>(
- const scoped_refptr<Window>& global_interface,
+template <typename GlobalInterface>
+void MozjsGlobalEnvironment::CreateGlobalObject(
+ const scoped_refptr<GlobalInterface>& global_interface,
EnvironmentSettings* environment_settings) {
- MozjsGlobalEnvironment* mozjs_global_environment =
- base::polymorphic_downcast<MozjsGlobalEnvironment*>(this);
- JSContext* context = mozjs_global_environment->context();
+ JSAutoRequest auto_request(context_);
+ MozjsWindow::CreateProxy(context_, global_interface);
- JSAutoRequest auto_request(context);
- MozjsWindow::CreateProxy(
- context, global_interface);
- mozjs_global_environment->SetEnvironmentSettings(environment_settings);
- mozjs_global_environment->EvaluateAutomatics();
+ DCHECK(!environment_settings_);
+ DCHECK(environment_settings);
+ environment_settings_ = environment_settings;
+ EvaluateAutomatics();
- WrapperFactory* wrapper_factory =
- mozjs_global_environment->wrapper_factory();
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
AnonymousIndexedGetterInterface::AnonymousIndexedGetterInterfaceWrappableType(),
base::Bind(MozjsAnonymousIndexedGetterInterface::CreateProxy),
base::Bind(MozjsAnonymousIndexedGetterInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
AnonymousNamedGetterInterface::AnonymousNamedGetterInterfaceWrappableType(),
base::Bind(MozjsAnonymousNamedGetterInterface::CreateProxy),
base::Bind(MozjsAnonymousNamedGetterInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
AnonymousNamedIndexedGetterInterface::AnonymousNamedIndexedGetterInterfaceWrappableType(),
base::Bind(MozjsAnonymousNamedIndexedGetterInterface::CreateProxy),
base::Bind(MozjsAnonymousNamedIndexedGetterInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
ArbitraryInterface::ArbitraryInterfaceWrappableType(),
base::Bind(MozjsArbitraryInterface::CreateProxy),
base::Bind(MozjsArbitraryInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
BaseInterface::BaseInterfaceWrappableType(),
base::Bind(MozjsBaseInterface::CreateProxy),
base::Bind(MozjsBaseInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
BooleanTypeTestInterface::BooleanTypeTestInterfaceWrappableType(),
base::Bind(MozjsBooleanTypeTestInterface::CreateProxy),
base::Bind(MozjsBooleanTypeTestInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
CallbackFunctionInterface::CallbackFunctionInterfaceWrappableType(),
base::Bind(MozjsCallbackFunctionInterface::CreateProxy),
base::Bind(MozjsCallbackFunctionInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
CallbackInterfaceInterface::CallbackInterfaceInterfaceWrappableType(),
base::Bind(MozjsCallbackInterfaceInterface::CreateProxy),
base::Bind(MozjsCallbackInterfaceInterface::PrototypeClass));
#if defined(ENABLE_CONDITIONAL_INTERFACE)
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
ConditionalInterface::ConditionalInterfaceWrappableType(),
base::Bind(MozjsConditionalInterface::CreateProxy),
base::Bind(MozjsConditionalInterface::PrototypeClass));
#endif // defined(ENABLE_CONDITIONAL_INTERFACE)
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
ConstantsInterface::ConstantsInterfaceWrappableType(),
base::Bind(MozjsConstantsInterface::CreateProxy),
base::Bind(MozjsConstantsInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
ConstructorInterface::ConstructorInterfaceWrappableType(),
base::Bind(MozjsConstructorInterface::CreateProxy),
base::Bind(MozjsConstructorInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
ConstructorWithArgumentsInterface::ConstructorWithArgumentsInterfaceWrappableType(),
base::Bind(MozjsConstructorWithArgumentsInterface::CreateProxy),
base::Bind(MozjsConstructorWithArgumentsInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
DOMStringTestInterface::DOMStringTestInterfaceWrappableType(),
base::Bind(MozjsDOMStringTestInterface::CreateProxy),
base::Bind(MozjsDOMStringTestInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
DerivedGetterSetterInterface::DerivedGetterSetterInterfaceWrappableType(),
base::Bind(MozjsDerivedGetterSetterInterface::CreateProxy),
base::Bind(MozjsDerivedGetterSetterInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
DerivedInterface::DerivedInterfaceWrappableType(),
base::Bind(MozjsDerivedInterface::CreateProxy),
base::Bind(MozjsDerivedInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
DictionaryInterface::DictionaryInterfaceWrappableType(),
base::Bind(MozjsDictionaryInterface::CreateProxy),
base::Bind(MozjsDictionaryInterface::PrototypeClass));
#if defined(NO_ENABLE_CONDITIONAL_INTERFACE)
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
DisabledInterface::DisabledInterfaceWrappableType(),
base::Bind(MozjsDisabledInterface::CreateProxy),
base::Bind(MozjsDisabledInterface::PrototypeClass));
#endif // defined(NO_ENABLE_CONDITIONAL_INTERFACE)
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
EnumerationInterface::EnumerationInterfaceWrappableType(),
base::Bind(MozjsEnumerationInterface::CreateProxy),
base::Bind(MozjsEnumerationInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
ExceptionObjectInterface::ExceptionObjectInterfaceWrappableType(),
base::Bind(MozjsExceptionObjectInterface::CreateProxy),
base::Bind(MozjsExceptionObjectInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
ExceptionsInterface::ExceptionsInterfaceWrappableType(),
base::Bind(MozjsExceptionsInterface::CreateProxy),
base::Bind(MozjsExceptionsInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
ExtendedIDLAttributesInterface::ExtendedIDLAttributesInterfaceWrappableType(),
base::Bind(MozjsExtendedIDLAttributesInterface::CreateProxy),
base::Bind(MozjsExtendedIDLAttributesInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
GarbageCollectionTestInterface::GarbageCollectionTestInterfaceWrappableType(),
base::Bind(MozjsGarbageCollectionTestInterface::CreateProxy),
base::Bind(MozjsGarbageCollectionTestInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
GlobalInterfaceParent::GlobalInterfaceParentWrappableType(),
base::Bind(MozjsGlobalInterfaceParent::CreateProxy),
base::Bind(MozjsGlobalInterfaceParent::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
ImplementedInterface::ImplementedInterfaceWrappableType(),
base::Bind(MozjsImplementedInterface::CreateProxy),
base::Bind(MozjsImplementedInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
IndexedGetterInterface::IndexedGetterInterfaceWrappableType(),
base::Bind(MozjsIndexedGetterInterface::CreateProxy),
base::Bind(MozjsIndexedGetterInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
InterfaceWithAny::InterfaceWithAnyWrappableType(),
base::Bind(MozjsInterfaceWithAny::CreateProxy),
base::Bind(MozjsInterfaceWithAny::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
InterfaceWithAnyDictionary::InterfaceWithAnyDictionaryWrappableType(),
base::Bind(MozjsInterfaceWithAnyDictionary::CreateProxy),
base::Bind(MozjsInterfaceWithAnyDictionary::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
InterfaceWithUnsupportedProperties::InterfaceWithUnsupportedPropertiesWrappableType(),
base::Bind(MozjsInterfaceWithUnsupportedProperties::CreateProxy),
base::Bind(MozjsInterfaceWithUnsupportedProperties::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
NamedConstructorInterface::NamedConstructorInterfaceWrappableType(),
base::Bind(MozjsNamedConstructorInterface::CreateProxy),
base::Bind(MozjsNamedConstructorInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
NamedGetterInterface::NamedGetterInterfaceWrappableType(),
base::Bind(MozjsNamedGetterInterface::CreateProxy),
base::Bind(MozjsNamedGetterInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
NamedIndexedGetterInterface::NamedIndexedGetterInterfaceWrappableType(),
base::Bind(MozjsNamedIndexedGetterInterface::CreateProxy),
base::Bind(MozjsNamedIndexedGetterInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
NestedPutForwardsInterface::NestedPutForwardsInterfaceWrappableType(),
base::Bind(MozjsNestedPutForwardsInterface::CreateProxy),
base::Bind(MozjsNestedPutForwardsInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
NoConstructorInterface::NoConstructorInterfaceWrappableType(),
base::Bind(MozjsNoConstructorInterface::CreateProxy),
base::Bind(MozjsNoConstructorInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
NoInterfaceObjectInterface::NoInterfaceObjectInterfaceWrappableType(),
base::Bind(MozjsNoInterfaceObjectInterface::CreateProxy),
base::Bind(MozjsNoInterfaceObjectInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
NullableTypesTestInterface::NullableTypesTestInterfaceWrappableType(),
base::Bind(MozjsNullableTypesTestInterface::CreateProxy),
base::Bind(MozjsNullableTypesTestInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
NumericTypesTestInterface::NumericTypesTestInterfaceWrappableType(),
base::Bind(MozjsNumericTypesTestInterface::CreateProxy),
base::Bind(MozjsNumericTypesTestInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
ObjectTypeBindingsInterface::ObjectTypeBindingsInterfaceWrappableType(),
base::Bind(MozjsObjectTypeBindingsInterface::CreateProxy),
base::Bind(MozjsObjectTypeBindingsInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
OperationsTestInterface::OperationsTestInterfaceWrappableType(),
base::Bind(MozjsOperationsTestInterface::CreateProxy),
base::Bind(MozjsOperationsTestInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
PromiseInterface::PromiseInterfaceWrappableType(),
base::Bind(MozjsPromiseInterface::CreateProxy),
base::Bind(MozjsPromiseInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
PutForwardsInterface::PutForwardsInterfaceWrappableType(),
base::Bind(MozjsPutForwardsInterface::CreateProxy),
base::Bind(MozjsPutForwardsInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
SequenceUser::SequenceUserWrappableType(),
base::Bind(MozjsSequenceUser::CreateProxy),
base::Bind(MozjsSequenceUser::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
StaticPropertiesInterface::StaticPropertiesInterfaceWrappableType(),
base::Bind(MozjsStaticPropertiesInterface::CreateProxy),
base::Bind(MozjsStaticPropertiesInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
StringifierAnonymousOperationInterface::StringifierAnonymousOperationInterfaceWrappableType(),
base::Bind(MozjsStringifierAnonymousOperationInterface::CreateProxy),
base::Bind(MozjsStringifierAnonymousOperationInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
StringifierAttributeInterface::StringifierAttributeInterfaceWrappableType(),
base::Bind(MozjsStringifierAttributeInterface::CreateProxy),
base::Bind(MozjsStringifierAttributeInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
StringifierOperationInterface::StringifierOperationInterfaceWrappableType(),
base::Bind(MozjsStringifierOperationInterface::CreateProxy),
base::Bind(MozjsStringifierOperationInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
TargetInterface::TargetInterfaceWrappableType(),
base::Bind(MozjsTargetInterface::CreateProxy),
base::Bind(MozjsTargetInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
UnionTypesInterface::UnionTypesInterfaceWrappableType(),
base::Bind(MozjsUnionTypesInterface::CreateProxy),
base::Bind(MozjsUnionTypesInterface::PrototypeClass));
- wrapper_factory->RegisterWrappableType(
+ wrapper_factory_->RegisterWrappableType(
Window::WindowWrappableType(),
base::Bind(DummyFunctor),
base::Bind(MozjsWindow::PrototypeClass));
}
+} // namespace mozjs
+
+template<>
+void GlobalEnvironment::CreateGlobalObject<Window>(
+ const scoped_refptr<Window>& global_interface,
+ EnvironmentSettings* environment_settings) {
+ base::polymorphic_downcast<MozjsGlobalEnvironment*>(this)->CreateGlobalObject(
+ global_interface, environment_settings);
+}
+
} // namespace script
} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/derived_dictionary.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/derived_dictionary.h
new file mode 100644
index 0000000..cd27ab6
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/derived_dictionary.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/templates/dictionary.h.template
+
+#ifndef DerivedDictionary_h
+#define DerivedDictionary_h
+
+#include <string>
+
+#include "base/optional.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/sequence.h"
+#include "cobalt/script/value_handle.h"
+#include "cobalt/bindings/testing/test_dictionary.h"
+
+using cobalt::bindings::testing::TestDictionary;
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class DerivedDictionary : public cobalt::bindings::testing::TestDictionary {
+ public:
+ DerivedDictionary() {
+ additional_member_ = false;
+ }
+
+ DerivedDictionary(const DerivedDictionary& other)
+ : cobalt::bindings::testing::TestDictionary(other) {
+ additional_member_ = other.additional_member_;
+ }
+
+ DerivedDictionary& operator=(const DerivedDictionary& other) {
+ cobalt::bindings::testing::TestDictionary::operator=(other);
+ additional_member_ = other.additional_member_;
+ return *this;
+ }
+
+ bool has_additional_member() const {
+ return true;
+ }
+ bool additional_member() const {
+ return additional_member_;
+ }
+ void set_additional_member(bool value) {
+ additional_member_ = value;
+ }
+
+ private:
+ bool additional_member_;
+};
+
+// This ostream override is necessary for MOCK_METHODs commonly used
+// in idl test code
+inline std::ostream& operator<<(
+ std::ostream& stream, const cobalt::bindings::testing::DerivedDictionary& in) {
+ UNREFERENCED_PARAMETER(in);
+ stream << "[DerivedDictionary]";
+ return stream;
+}
+
+} // namespace cobalt
+} // namespace bindings
+} // namespace testing
+
+#endif // DerivedDictionary_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
new file mode 100644
index 0000000..02dbce6
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/templates/dictionary.h.template
+
+#ifndef DictionaryWithDictionaryMember_h
+#define DictionaryWithDictionaryMember_h
+
+#include <string>
+
+#include "base/optional.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/sequence.h"
+#include "cobalt/script/value_handle.h"
+#include "cobalt/bindings/testing/test_dictionary.h"
+
+using cobalt::bindings::testing::TestDictionary;
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class DictionaryWithDictionaryMember {
+ public:
+ DictionaryWithDictionaryMember() {
+ has_nested_dictionary_ = false;
+ nested_dictionary_ = TestDictionary();
+ }
+
+ DictionaryWithDictionaryMember(const DictionaryWithDictionaryMember& other) {
+ has_nested_dictionary_ = other.has_nested_dictionary_;
+ nested_dictionary_ = other.nested_dictionary_;
+ }
+
+ DictionaryWithDictionaryMember& operator=(const DictionaryWithDictionaryMember& other) {
+ has_nested_dictionary_ = other.has_nested_dictionary_;
+ nested_dictionary_ = other.nested_dictionary_;
+ return *this;
+ }
+
+ bool has_nested_dictionary() const {
+ return has_nested_dictionary_;
+ }
+ TestDictionary nested_dictionary() const {
+ DCHECK(has_nested_dictionary_);
+ return nested_dictionary_;
+ }
+ void set_nested_dictionary(TestDictionary value) {
+ has_nested_dictionary_ = true;
+ nested_dictionary_ = value;
+ }
+
+ private:
+ bool has_nested_dictionary_;
+ TestDictionary nested_dictionary_;
+};
+
+// This ostream override is necessary for MOCK_METHODs commonly used
+// in idl test code
+inline std::ostream& operator<<(
+ std::ostream& stream, const cobalt::bindings::testing::DictionaryWithDictionaryMember& in) {
+ UNREFERENCED_PARAMETER(in);
+ stream << "[DictionaryWithDictionaryMember]";
+ return stream;
+}
+
+} // namespace cobalt
+} // namespace bindings
+} // namespace testing
+
+#endif // DictionaryWithDictionaryMember_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/test_dictionary.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/test_dictionary.h
new file mode 100644
index 0000000..4ec2228
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/test_dictionary.h
@@ -0,0 +1,289 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/templates/dictionary.h.template
+
+#ifndef TestDictionary_h
+#define TestDictionary_h
+
+#include <string>
+
+#include "base/optional.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/sequence.h"
+#include "cobalt/script/value_handle.h"
+#include "cobalt/bindings/testing/arbitrary_interface.h"
+
+using cobalt::bindings::testing::ArbitraryInterface;
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class TestDictionary {
+ public:
+ TestDictionary() {
+ has_boolean_member_ = false;
+ boolean_member_ = bool();
+ has_short_clamp_member_ = false;
+ short_clamp_member_ = int16_t();
+ has_long_member_ = false;
+ long_member_ = int32_t();
+ has_double_member_ = false;
+ double_member_ = double();
+ has_string_member_ = false;
+ string_member_ = std::string();
+ has_interface_member_ = false;
+ interface_member_ = scoped_refptr<ArbitraryInterface>();
+ member_with_default_ = 5;
+ has_non_default_member_ = false;
+ non_default_member_ = int32_t();
+ has_any_member_ = false;
+ }
+
+ TestDictionary(const TestDictionary& other) {
+ has_boolean_member_ = other.has_boolean_member_;
+ boolean_member_ = other.boolean_member_;
+ has_short_clamp_member_ = other.has_short_clamp_member_;
+ short_clamp_member_ = other.short_clamp_member_;
+ has_long_member_ = other.has_long_member_;
+ long_member_ = other.long_member_;
+ has_double_member_ = other.has_double_member_;
+ double_member_ = other.double_member_;
+ has_string_member_ = other.has_string_member_;
+ string_member_ = other.string_member_;
+ has_interface_member_ = other.has_interface_member_;
+ interface_member_ = other.interface_member_;
+ member_with_default_ = other.member_with_default_;
+ has_non_default_member_ = other.has_non_default_member_;
+ non_default_member_ = other.non_default_member_;
+ if (other.any_member_with_default_) {
+ any_member_with_default_.reset(
+ new script::ScriptValue<::cobalt::script::ValueHandle>::StrongReference(
+ other.any_member_with_default_->referenced_value()));
+ }
+ has_any_member_ = other.has_any_member_;
+ if (other.any_member_) {
+ any_member_.reset(
+ new script::ScriptValue<::cobalt::script::ValueHandle>::StrongReference(
+ other.any_member_->referenced_value()));
+ }
+ }
+
+ TestDictionary& operator=(const TestDictionary& other) {
+ has_boolean_member_ = other.has_boolean_member_;
+ boolean_member_ = other.boolean_member_;
+ has_short_clamp_member_ = other.has_short_clamp_member_;
+ short_clamp_member_ = other.short_clamp_member_;
+ has_long_member_ = other.has_long_member_;
+ long_member_ = other.long_member_;
+ has_double_member_ = other.has_double_member_;
+ double_member_ = other.double_member_;
+ has_string_member_ = other.has_string_member_;
+ string_member_ = other.string_member_;
+ has_interface_member_ = other.has_interface_member_;
+ interface_member_ = other.interface_member_;
+ member_with_default_ = other.member_with_default_;
+ has_non_default_member_ = other.has_non_default_member_;
+ non_default_member_ = other.non_default_member_;
+ if (other.any_member_with_default_) {
+ any_member_with_default_.reset(
+ new script::ScriptValue<::cobalt::script::ValueHandle>::StrongReference(
+ other.any_member_with_default_->referenced_value()));
+ } else {
+ any_member_with_default_.reset();
+ }
+ has_any_member_ = other.has_any_member_;
+ if (other.any_member_) {
+ any_member_.reset(
+ new script::ScriptValue<::cobalt::script::ValueHandle>::StrongReference(
+ other.any_member_->referenced_value()));
+ } else {
+ any_member_.reset();
+ }
+ return *this;
+ }
+
+ bool has_boolean_member() const {
+ return has_boolean_member_;
+ }
+ bool boolean_member() const {
+ DCHECK(has_boolean_member_);
+ return boolean_member_;
+ }
+ void set_boolean_member(bool value) {
+ has_boolean_member_ = true;
+ boolean_member_ = value;
+ }
+
+ bool has_short_clamp_member() const {
+ return has_short_clamp_member_;
+ }
+ int16_t short_clamp_member() const {
+ DCHECK(has_short_clamp_member_);
+ return short_clamp_member_;
+ }
+ void set_short_clamp_member(int16_t value) {
+ has_short_clamp_member_ = true;
+ short_clamp_member_ = value;
+ }
+
+ bool has_long_member() const {
+ return has_long_member_;
+ }
+ int32_t long_member() const {
+ DCHECK(has_long_member_);
+ return long_member_;
+ }
+ void set_long_member(int32_t value) {
+ has_long_member_ = true;
+ long_member_ = value;
+ }
+
+ bool has_double_member() const {
+ return has_double_member_;
+ }
+ double double_member() const {
+ DCHECK(has_double_member_);
+ return double_member_;
+ }
+ void set_double_member(double value) {
+ has_double_member_ = true;
+ double_member_ = value;
+ }
+
+ bool has_string_member() const {
+ return has_string_member_;
+ }
+ const std::string& string_member() const {
+ DCHECK(has_string_member_);
+ return string_member_;
+ }
+ void set_string_member(const std::string& value) {
+ has_string_member_ = true;
+ string_member_ = value;
+ }
+
+ bool has_interface_member() const {
+ return has_interface_member_;
+ }
+ const scoped_refptr<ArbitraryInterface>& interface_member() const {
+ DCHECK(has_interface_member_);
+ return interface_member_;
+ }
+ void set_interface_member(const scoped_refptr<ArbitraryInterface>& value) {
+ has_interface_member_ = true;
+ interface_member_ = value;
+ }
+
+ bool has_member_with_default() const {
+ return true;
+ }
+ int32_t member_with_default() const {
+ return member_with_default_;
+ }
+ void set_member_with_default(int32_t value) {
+ member_with_default_ = value;
+ }
+
+ bool has_non_default_member() const {
+ return has_non_default_member_;
+ }
+ int32_t non_default_member() const {
+ DCHECK(has_non_default_member_);
+ return non_default_member_;
+ }
+ void set_non_default_member(int32_t value) {
+ has_non_default_member_ = true;
+ non_default_member_ = value;
+ }
+
+ bool has_any_member_with_default() const {
+ return true;
+ }
+ const ::cobalt::script::ScriptValue<::cobalt::script::ValueHandle>* any_member_with_default() const {
+ if (!any_member_with_default_) {
+ return NULL;
+ }
+ return &(any_member_with_default_->referenced_value());
+ }
+ void set_any_member_with_default(const ::cobalt::script::ScriptValue<::cobalt::script::ValueHandle>* value) {
+ if (value) {
+ any_member_with_default_.reset(
+ new script::ScriptValue<::cobalt::script::ValueHandle>::StrongReference(*value));
+ } else {
+ any_member_with_default_.reset();
+ }
+ }
+
+ bool has_any_member() const {
+ return has_any_member_;
+ }
+ const ::cobalt::script::ScriptValue<::cobalt::script::ValueHandle>* any_member() const {
+ DCHECK(has_any_member_);
+ if (!any_member_) {
+ return NULL;
+ }
+ return &(any_member_->referenced_value());
+ }
+ void set_any_member(const ::cobalt::script::ScriptValue<::cobalt::script::ValueHandle>* value) {
+ has_any_member_ = true;
+ if (value) {
+ any_member_.reset(
+ new script::ScriptValue<::cobalt::script::ValueHandle>::StrongReference(*value));
+ } else {
+ any_member_.reset();
+ }
+ }
+
+ private:
+ bool has_boolean_member_;
+ bool boolean_member_;
+ bool has_short_clamp_member_;
+ int16_t short_clamp_member_;
+ bool has_long_member_;
+ int32_t long_member_;
+ bool has_double_member_;
+ double double_member_;
+ bool has_string_member_;
+ std::string string_member_;
+ bool has_interface_member_;
+ scoped_refptr<ArbitraryInterface> interface_member_;
+ int32_t member_with_default_;
+ bool has_non_default_member_;
+ int32_t non_default_member_;
+ scoped_ptr<script::ScriptValue<::cobalt::script::ValueHandle>::StrongReference> any_member_with_default_;
+ bool has_any_member_;
+ scoped_ptr<script::ScriptValue<::cobalt::script::ValueHandle>::StrongReference> any_member_;
+};
+
+// This ostream override is necessary for MOCK_METHODs commonly used
+// in idl test code
+inline std::ostream& operator<<(
+ std::ostream& stream, const cobalt::bindings::testing::TestDictionary& in) {
+ UNREFERENCED_PARAMETER(in);
+ stream << "[TestDictionary]";
+ return stream;
+}
+
+} // namespace cobalt
+} // namespace bindings
+} // namespace testing
+
+#endif // TestDictionary_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/test_enum.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/test_enum.h
new file mode 100644
index 0000000..5e4bb69
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/test_enum.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/templates/enumeration.h.template
+
+#ifndef TestEnum_h
+#define TestEnum_h
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+enum TestEnum {
+ kTestEnumAlpha,
+ kTestEnumBeta,
+ kTestEnumGamma,
+ kTestEnumEnumWithDashes,
+ kTestEnumEnumWithSpaces,
+ kTestEnumTerribleEnum,
+ kTestEnumThisIsATerribleEnum,
+};
+
+} // namespace cobalt
+} // namespace bindings
+} // namespace testing
+
+#endif // TestEnum_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_indexed_getter_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_indexed_getter_interface.cc
new file mode 100644
index 0000000..2883330
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_indexed_getter_interface.cc
@@ -0,0 +1,191 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_anonymous_indexed_getter_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::AnonymousIndexedGetterInterface;
+using cobalt::bindings::testing::V8cAnonymousIndexedGetterInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void AnonymousIndexedGetterInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_length(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ AnonymousIndexedGetterInterface* impl = static_cast<AnonymousIndexedGetterInterface*>(wrapper_private->wrappable<AnonymousIndexedGetterInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "AnonymousIndexedGetterInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "length",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_length
+ );
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 0;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cAnonymousIndexedGetterInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cAnonymousIndexedGetterInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_indexed_getter_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_indexed_getter_interface.h
new file mode 100644
index 0000000..4031ab3
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_indexed_getter_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cAnonymousIndexedGetterInterface_h
+#define V8cAnonymousIndexedGetterInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/anonymous_indexed_getter_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cAnonymousIndexedGetterInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cAnonymousIndexedGetterInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_named_getter_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_named_getter_interface.cc
new file mode 100644
index 0000000..2fed76f
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_named_getter_interface.cc
@@ -0,0 +1,170 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_anonymous_named_getter_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::AnonymousNamedGetterInterface;
+using cobalt::bindings::testing::V8cAnonymousNamedGetterInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void AnonymousNamedGetterInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "AnonymousNamedGetterInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 1;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cAnonymousNamedGetterInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cAnonymousNamedGetterInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_named_getter_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_named_getter_interface.h
new file mode 100644
index 0000000..6dfff10
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_named_getter_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cAnonymousNamedGetterInterface_h
+#define V8cAnonymousNamedGetterInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/anonymous_named_getter_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cAnonymousNamedGetterInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cAnonymousNamedGetterInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_named_indexed_getter_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_named_indexed_getter_interface.cc
new file mode 100644
index 0000000..44a8765
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_named_indexed_getter_interface.cc
@@ -0,0 +1,191 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_anonymous_named_indexed_getter_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::AnonymousNamedIndexedGetterInterface;
+using cobalt::bindings::testing::V8cAnonymousNamedIndexedGetterInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void AnonymousNamedIndexedGetterInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_length(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ AnonymousNamedIndexedGetterInterface* impl = static_cast<AnonymousNamedIndexedGetterInterface*>(wrapper_private->wrappable<AnonymousNamedIndexedGetterInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "AnonymousNamedIndexedGetterInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "length",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_length
+ );
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 2;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cAnonymousNamedIndexedGetterInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cAnonymousNamedIndexedGetterInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_named_indexed_getter_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_named_indexed_getter_interface.h
new file mode 100644
index 0000000..07a6fa9
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_anonymous_named_indexed_getter_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cAnonymousNamedIndexedGetterInterface_h
+#define V8cAnonymousNamedIndexedGetterInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/anonymous_named_indexed_getter_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cAnonymousNamedIndexedGetterInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cAnonymousNamedIndexedGetterInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_arbitrary_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_arbitrary_interface.cc
new file mode 100644
index 0000000..33694aa
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_arbitrary_interface.cc
@@ -0,0 +1,217 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_arbitrary_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::ArbitraryInterface;
+using cobalt::bindings::testing::V8cArbitraryInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void ArbitraryInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_arbitraryProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ArbitraryInterface* impl = static_cast<ArbitraryInterface*>(wrapper_private->wrappable<ArbitraryInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_arbitraryProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ArbitraryInterface* impl = static_cast<ArbitraryInterface*>(wrapper_private->wrappable<ArbitraryInterface>());
+
+ TypeTraits<std::string>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_arbitrary_property(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "ArbitraryInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "arbitraryProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_arbitraryProperty
+ ,v8cSet_arbitraryProperty
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "arbitraryFunction",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 3;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cArbitraryInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cArbitraryInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_arbitrary_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_arbitrary_interface.h
new file mode 100644
index 0000000..fee3b78
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_arbitrary_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cArbitraryInterface_h
+#define V8cArbitraryInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/arbitrary_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cArbitraryInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cArbitraryInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_base_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_base_interface.cc
new file mode 100644
index 0000000..ae6dbeb
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_base_interface.cc
@@ -0,0 +1,198 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_base_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::BaseInterface;
+using cobalt::bindings::testing::V8cBaseInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void BaseInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_baseAttribute(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ BaseInterface* impl = static_cast<BaseInterface*>(wrapper_private->wrappable<BaseInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "BaseInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "baseAttribute",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_baseAttribute
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "baseOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 4;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cBaseInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cBaseInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_base_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_base_interface.h
new file mode 100644
index 0000000..429707a
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_base_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cBaseInterface_h
+#define V8cBaseInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/base_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cBaseInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cBaseInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_boolean_type_test_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_boolean_type_test_interface.cc
new file mode 100644
index 0000000..3885210
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_boolean_type_test_interface.cc
@@ -0,0 +1,224 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_boolean_type_test_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::BooleanTypeTestInterface;
+using cobalt::bindings::testing::V8cBooleanTypeTestInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void BooleanTypeTestInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_booleanProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ BooleanTypeTestInterface* impl = static_cast<BooleanTypeTestInterface*>(wrapper_private->wrappable<BooleanTypeTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_booleanProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ BooleanTypeTestInterface* impl = static_cast<BooleanTypeTestInterface*>(wrapper_private->wrappable<BooleanTypeTestInterface>());
+
+ TypeTraits<bool>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_boolean_property(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "BooleanTypeTestInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "booleanProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_booleanProperty
+ ,v8cSet_booleanProperty
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "booleanArgumentOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "booleanReturnOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 5;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cBooleanTypeTestInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cBooleanTypeTestInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_boolean_type_test_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_boolean_type_test_interface.h
new file mode 100644
index 0000000..80ab3b1
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_boolean_type_test_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cBooleanTypeTestInterface_h
+#define V8cBooleanTypeTestInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/boolean_type_test_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cBooleanTypeTestInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cBooleanTypeTestInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_callback_function_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_callback_function_interface.cc
new file mode 100644
index 0000000..0304336
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_callback_function_interface.cc
@@ -0,0 +1,289 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_callback_function_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+#include "cobalt/bindings/testing/arbitrary_interface.h"
+#include "cobalt/bindings/testing/v8c_arbitrary_interface.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::CallbackFunctionInterface;
+using cobalt::bindings::testing::V8cCallbackFunctionInterface;
+using cobalt::bindings::testing::ArbitraryInterface;
+using cobalt::bindings::testing::V8cArbitraryInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void CallbackFunctionInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_callbackAttribute(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ CallbackFunctionInterface* impl = static_cast<CallbackFunctionInterface*>(wrapper_private->wrappable<CallbackFunctionInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_callbackAttribute(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ CallbackFunctionInterface* impl = static_cast<CallbackFunctionInterface*>(wrapper_private->wrappable<CallbackFunctionInterface>());
+
+ TypeTraits<CallbackFunctionInterface::VoidFunction>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_callback_attribute(
+ conversion_value
+ );
+}
+
+
+
+void v8cGet_nullableCallbackAttribute(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ CallbackFunctionInterface* impl = static_cast<CallbackFunctionInterface*>(wrapper_private->wrappable<CallbackFunctionInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_nullableCallbackAttribute(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ CallbackFunctionInterface* impl = static_cast<CallbackFunctionInterface*>(wrapper_private->wrappable<CallbackFunctionInterface>());
+
+ TypeTraits<CallbackFunctionInterface::VoidFunction>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagNullable), &exception_state, &conversion_value);
+ impl->set_nullable_callback_attribute(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "CallbackFunctionInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "callbackAttribute",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_callbackAttribute
+ ,v8cSet_callbackAttribute
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "nullableCallbackAttribute",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_nullableCallbackAttribute
+ ,v8cSet_nullableCallbackAttribute
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "takesFunctionThatReturnsString",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "takesFunctionWithNullableParameters",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "takesFunctionWithOneParameter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "takesFunctionWithSeveralParameters",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "takesVoidFunction",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 6;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cCallbackFunctionInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cCallbackFunctionInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_callback_function_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_callback_function_interface.h
new file mode 100644
index 0000000..5fcc5da
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_callback_function_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cCallbackFunctionInterface_h
+#define V8cCallbackFunctionInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/callback_function_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cCallbackFunctionInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cCallbackFunctionInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_callback_interface_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_callback_interface_interface.cc
new file mode 100644
index 0000000..683397b
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_callback_interface_interface.cc
@@ -0,0 +1,228 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_callback_interface_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+#include "cobalt/bindings/testing/single_operation_interface.h"
+#include "cobalt/bindings/testing/v8c_single_operation_interface.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::CallbackInterfaceInterface;
+using cobalt::bindings::testing::V8cCallbackInterfaceInterface;
+using cobalt::bindings::testing::SingleOperationInterface;
+using cobalt::bindings::testing::V8cSingleOperationInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void CallbackInterfaceInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_callbackAttribute(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ CallbackInterfaceInterface* impl = static_cast<CallbackInterfaceInterface*>(wrapper_private->wrappable<CallbackInterfaceInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_callbackAttribute(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ CallbackInterfaceInterface* impl = static_cast<CallbackInterfaceInterface*>(wrapper_private->wrappable<CallbackInterfaceInterface>());
+
+ TypeTraits<::cobalt::script::CallbackInterfaceTraits<SingleOperationInterface >>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagNullable), &exception_state, &conversion_value);
+ impl->set_callback_attribute(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "CallbackInterfaceInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "callbackAttribute",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_callbackAttribute
+ ,v8cSet_callbackAttribute
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "registerCallback",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "someOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 7;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cCallbackInterfaceInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cCallbackInterfaceInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_callback_interface_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_callback_interface_interface.h
new file mode 100644
index 0000000..f134c69
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_callback_interface_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cCallbackInterfaceInterface_h
+#define V8cCallbackInterfaceInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/callback_interface_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cCallbackInterfaceInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cCallbackInterfaceInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_conditional_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_conditional_interface.cc
new file mode 100644
index 0000000..94f8e5d
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_conditional_interface.cc
@@ -0,0 +1,275 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#if defined(ENABLE_CONDITIONAL_INTERFACE)
+
+#include "cobalt/bindings/testing/v8c_conditional_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::ConditionalInterface;
+using cobalt::bindings::testing::V8cConditionalInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void ConditionalInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+#if defined(ENABLE_CONDITIONAL_PROPERTY)
+
+void v8cGet_enabledAttribute(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ConditionalInterface* impl = static_cast<ConditionalInterface*>(wrapper_private->wrappable<ConditionalInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_enabledAttribute(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ConditionalInterface* impl = static_cast<ConditionalInterface*>(wrapper_private->wrappable<ConditionalInterface>());
+
+ TypeTraits<int32_t>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_enabled_attribute(
+ conversion_value
+ );
+}
+
+
+#endif // ENABLE_CONDITIONAL_PROPERTY
+#if defined(NO_ENABLE_CONDITIONAL_PROPERTY)
+
+void v8cGet_disabledAttribute(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ConditionalInterface* impl = static_cast<ConditionalInterface*>(wrapper_private->wrappable<ConditionalInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_disabledAttribute(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ConditionalInterface* impl = static_cast<ConditionalInterface*>(wrapper_private->wrappable<ConditionalInterface>());
+
+ TypeTraits<int32_t>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_disabled_attribute(
+ conversion_value
+ );
+}
+
+
+#endif // NO_ENABLE_CONDITIONAL_PROPERTY
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "ConditionalInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+#if defined(ENABLE_CONDITIONAL_PROPERTY)
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "enabledAttribute",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_enabledAttribute
+ ,v8cSet_enabledAttribute
+ );
+#endif // ENABLE_CONDITIONAL_PROPERTY
+#if defined(NO_ENABLE_CONDITIONAL_PROPERTY)
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "disabledAttribute",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_disabledAttribute
+ ,v8cSet_disabledAttribute
+ );
+#endif // NO_ENABLE_CONDITIONAL_PROPERTY
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "disabledOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "enabledOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 8;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cConditionalInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cConditionalInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
+#endif // defined(ENABLE_CONDITIONAL_INTERFACE)
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_conditional_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_conditional_interface.h
new file mode 100644
index 0000000..0ceed59
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_conditional_interface.h
@@ -0,0 +1,54 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cConditionalInterface_h
+#define V8cConditionalInterface_h
+
+#if defined(ENABLE_CONDITIONAL_INTERFACE)
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/conditional_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cConditionalInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // defined(ENABLE_CONDITIONAL_INTERFACE)
+
+#endif // V8cConditionalInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constants_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constants_interface.cc
new file mode 100644
index 0000000..8fbc01f
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constants_interface.cc
@@ -0,0 +1,170 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_constants_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::ConstantsInterface;
+using cobalt::bindings::testing::V8cConstantsInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void ConstantsInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "ConstantsInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 9;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cConstantsInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cConstantsInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constants_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constants_interface.h
new file mode 100644
index 0000000..22e49c0
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constants_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cConstantsInterface_h
+#define V8cConstantsInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/constants_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cConstantsInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cConstantsInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constructor_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constructor_interface.cc
new file mode 100644
index 0000000..8de3e47
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constructor_interface.cc
@@ -0,0 +1,170 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_constructor_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::ConstructorInterface;
+using cobalt::bindings::testing::V8cConstructorInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void ConstructorInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "ConstructorInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 10;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cConstructorInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cConstructorInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constructor_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constructor_interface.h
new file mode 100644
index 0000000..9f8db95
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constructor_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cConstructorInterface_h
+#define V8cConstructorInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/constructor_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cConstructorInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cConstructorInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constructor_with_arguments_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constructor_with_arguments_interface.cc
new file mode 100644
index 0000000..5885ede
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constructor_with_arguments_interface.cc
@@ -0,0 +1,233 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_constructor_with_arguments_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::ConstructorWithArgumentsInterface;
+using cobalt::bindings::testing::V8cConstructorWithArgumentsInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void ConstructorWithArgumentsInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_longArg(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ConstructorWithArgumentsInterface* impl = static_cast<ConstructorWithArgumentsInterface*>(wrapper_private->wrappable<ConstructorWithArgumentsInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void v8cGet_booleanArg(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ConstructorWithArgumentsInterface* impl = static_cast<ConstructorWithArgumentsInterface*>(wrapper_private->wrappable<ConstructorWithArgumentsInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void v8cGet_stringArg(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ConstructorWithArgumentsInterface* impl = static_cast<ConstructorWithArgumentsInterface*>(wrapper_private->wrappable<ConstructorWithArgumentsInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "ConstructorWithArgumentsInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "longArg",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_longArg
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "booleanArg",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_booleanArg
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "stringArg",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_stringArg
+ );
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 11;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cConstructorWithArgumentsInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cConstructorWithArgumentsInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constructor_with_arguments_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constructor_with_arguments_interface.h
new file mode 100644
index 0000000..1711903
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_constructor_with_arguments_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cConstructorWithArgumentsInterface_h
+#define V8cConstructorWithArgumentsInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/constructor_with_arguments_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cConstructorWithArgumentsInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cConstructorWithArgumentsInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_dictionary.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_dictionary.cc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_dictionary.cc
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_getter_setter_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_getter_setter_interface.cc
new file mode 100644
index 0000000..b05d6cb
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_getter_setter_interface.cc
@@ -0,0 +1,256 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_derived_getter_setter_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+#include "cobalt/bindings/testing/named_indexed_getter_interface.h"
+#include "cobalt/bindings/testing/v8c_named_indexed_getter_interface.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::DerivedGetterSetterInterface;
+using cobalt::bindings::testing::V8cDerivedGetterSetterInterface;
+using cobalt::bindings::testing::NamedIndexedGetterInterface;
+using cobalt::bindings::testing::V8cNamedIndexedGetterInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void DerivedGetterSetterInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_length(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DerivedGetterSetterInterface* impl = static_cast<DerivedGetterSetterInterface*>(wrapper_private->wrappable<DerivedGetterSetterInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void v8cGet_propertyOnDerivedClass(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DerivedGetterSetterInterface* impl = static_cast<DerivedGetterSetterInterface*>(wrapper_private->wrappable<DerivedGetterSetterInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_propertyOnDerivedClass(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DerivedGetterSetterInterface* impl = static_cast<DerivedGetterSetterInterface*>(wrapper_private->wrappable<DerivedGetterSetterInterface>());
+
+ TypeTraits<bool>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_property_on_derived_class(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "DerivedGetterSetterInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "length",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_length
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "propertyOnDerivedClass",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_propertyOnDerivedClass
+ ,v8cSet_propertyOnDerivedClass
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "derivedIndexedGetter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "derivedIndexedSetter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "operationOnDerivedClass",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 14;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cDerivedGetterSetterInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cDerivedGetterSetterInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_getter_setter_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_getter_setter_interface.h
new file mode 100644
index 0000000..0bd0509
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_getter_setter_interface.h
@@ -0,0 +1,51 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cDerivedGetterSetterInterface_h
+#define V8cDerivedGetterSetterInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/derived_getter_setter_interface.h"
+#include "cobalt/bindings/testing/v8c_named_indexed_getter_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cDerivedGetterSetterInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cDerivedGetterSetterInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_interface.cc
new file mode 100644
index 0000000..b43c1dc
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_interface.cc
@@ -0,0 +1,202 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_derived_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+#include "cobalt/bindings/testing/base_interface.h"
+#include "cobalt/bindings/testing/v8c_base_interface.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::DerivedInterface;
+using cobalt::bindings::testing::V8cDerivedInterface;
+using cobalt::bindings::testing::BaseInterface;
+using cobalt::bindings::testing::V8cBaseInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void DerivedInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_derivedAttribute(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DerivedInterface* impl = static_cast<DerivedInterface*>(wrapper_private->wrappable<DerivedInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "DerivedInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "derivedAttribute",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_derivedAttribute
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "derivedOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 15;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cDerivedInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cDerivedInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_interface.h
new file mode 100644
index 0000000..245aa39
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_derived_interface.h
@@ -0,0 +1,51 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cDerivedInterface_h
+#define V8cDerivedInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/derived_interface.h"
+#include "cobalt/bindings/testing/v8c_base_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cDerivedInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cDerivedInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dictionary_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dictionary_interface.cc
new file mode 100644
index 0000000..705a8f0
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dictionary_interface.cc
@@ -0,0 +1,237 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_dictionary_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+#include "cobalt/bindings/testing/derived_dictionary.h"
+#include "cobalt/bindings/testing/dictionary_with_dictionary_member.h"
+#include "cobalt/bindings/testing/test_dictionary.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::DictionaryInterface;
+using cobalt::bindings::testing::V8cDictionaryInterface;
+using cobalt::bindings::testing::DerivedDictionary;
+using cobalt::bindings::testing::DictionaryWithDictionaryMember;
+using cobalt::bindings::testing::TestDictionary;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void DictionaryInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_dictionarySequence(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DictionaryInterface* impl = static_cast<DictionaryInterface*>(wrapper_private->wrappable<DictionaryInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_dictionarySequence(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DictionaryInterface* impl = static_cast<DictionaryInterface*>(wrapper_private->wrappable<DictionaryInterface>());
+
+ TypeTraits<::cobalt::script::Sequence< TestDictionary >>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_dictionary_sequence(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "DictionaryInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "dictionarySequence",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_dictionarySequence
+ ,v8cSet_dictionarySequence
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "derivedDictionaryOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "dictionaryOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "testOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 16;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cDictionaryInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cDictionaryInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dictionary_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dictionary_interface.h
new file mode 100644
index 0000000..0c81e13
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dictionary_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cDictionaryInterface_h
+#define V8cDictionaryInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/dictionary_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cDictionaryInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cDictionaryInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dictionary_with_dictionary_member.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dictionary_with_dictionary_member.cc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dictionary_with_dictionary_member.cc
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_disabled_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_disabled_interface.cc
new file mode 100644
index 0000000..987f284
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_disabled_interface.cc
@@ -0,0 +1,220 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#if defined(NO_ENABLE_CONDITIONAL_INTERFACE)
+
+#include "cobalt/bindings/testing/v8c_disabled_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::DisabledInterface;
+using cobalt::bindings::testing::V8cDisabledInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void DisabledInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_disabledProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DisabledInterface* impl = static_cast<DisabledInterface*>(wrapper_private->wrappable<DisabledInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_disabledProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DisabledInterface* impl = static_cast<DisabledInterface*>(wrapper_private->wrappable<DisabledInterface>());
+
+ TypeTraits<int32_t>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_disabled_property(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "DisabledInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "disabledProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_disabledProperty
+ ,v8cSet_disabledProperty
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "disabledFunction",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 18;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cDisabledInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cDisabledInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
+#endif // defined(NO_ENABLE_CONDITIONAL_INTERFACE)
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_disabled_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_disabled_interface.h
new file mode 100644
index 0000000..fb3b5fc
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_disabled_interface.h
@@ -0,0 +1,54 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cDisabledInterface_h
+#define V8cDisabledInterface_h
+
+#if defined(NO_ENABLE_CONDITIONAL_INTERFACE)
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/disabled_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cDisabledInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // defined(NO_ENABLE_CONDITIONAL_INTERFACE)
+
+#endif // V8cDisabledInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dom_string_test_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dom_string_test_interface.cc
new file mode 100644
index 0000000..0a89b27
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dom_string_test_interface.cc
@@ -0,0 +1,372 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_dom_string_test_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::DOMStringTestInterface;
+using cobalt::bindings::testing::V8cDOMStringTestInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void DOMStringTestInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_property(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DOMStringTestInterface* impl = static_cast<DOMStringTestInterface*>(wrapper_private->wrappable<DOMStringTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_property(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DOMStringTestInterface* impl = static_cast<DOMStringTestInterface*>(wrapper_private->wrappable<DOMStringTestInterface>());
+
+ TypeTraits<std::string>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_property(
+ conversion_value
+ );
+}
+
+
+
+void v8cGet_readOnlyProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DOMStringTestInterface* impl = static_cast<DOMStringTestInterface*>(wrapper_private->wrappable<DOMStringTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void v8cGet_readOnlyTokenProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DOMStringTestInterface* impl = static_cast<DOMStringTestInterface*>(wrapper_private->wrappable<DOMStringTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void v8cGet_nullIsEmptyProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DOMStringTestInterface* impl = static_cast<DOMStringTestInterface*>(wrapper_private->wrappable<DOMStringTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_nullIsEmptyProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DOMStringTestInterface* impl = static_cast<DOMStringTestInterface*>(wrapper_private->wrappable<DOMStringTestInterface>());
+
+ TypeTraits<std::string>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagTreatNullAsEmptyString), &exception_state, &conversion_value);
+ impl->set_null_is_empty_property(
+ conversion_value
+ );
+}
+
+
+
+void v8cGet_undefinedIsEmptyProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DOMStringTestInterface* impl = static_cast<DOMStringTestInterface*>(wrapper_private->wrappable<DOMStringTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_undefinedIsEmptyProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DOMStringTestInterface* impl = static_cast<DOMStringTestInterface*>(wrapper_private->wrappable<DOMStringTestInterface>());
+
+ TypeTraits<std::string>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagTreatUndefinedAsEmptyString), &exception_state, &conversion_value);
+ impl->set_undefined_is_empty_property(
+ conversion_value
+ );
+}
+
+
+
+void v8cGet_nullableUndefinedIsEmptyProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DOMStringTestInterface* impl = static_cast<DOMStringTestInterface*>(wrapper_private->wrappable<DOMStringTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_nullableUndefinedIsEmptyProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ DOMStringTestInterface* impl = static_cast<DOMStringTestInterface*>(wrapper_private->wrappable<DOMStringTestInterface>());
+
+ TypeTraits<base::optional<std::string >>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagNullable | kConversionFlagTreatUndefinedAsEmptyString), &exception_state, &conversion_value);
+ impl->set_nullable_undefined_is_empty_property(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "DOMStringTestInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "property",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_property
+ ,v8cSet_property
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "readOnlyProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_readOnlyProperty
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "readOnlyTokenProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_readOnlyTokenProperty
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "nullIsEmptyProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_nullIsEmptyProperty
+ ,v8cSet_nullIsEmptyProperty
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "undefinedIsEmptyProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_undefinedIsEmptyProperty
+ ,v8cSet_undefinedIsEmptyProperty
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "nullableUndefinedIsEmptyProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_nullableUndefinedIsEmptyProperty
+ ,v8cSet_nullableUndefinedIsEmptyProperty
+ );
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 12;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cDOMStringTestInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cDOMStringTestInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dom_string_test_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dom_string_test_interface.h
new file mode 100644
index 0000000..edb0d77
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_dom_string_test_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cDOMStringTestInterface_h
+#define V8cDOMStringTestInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/dom_string_test_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cDOMStringTestInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cDOMStringTestInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_enumeration_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_enumeration_interface.cc
new file mode 100644
index 0000000..5855537
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_enumeration_interface.cc
@@ -0,0 +1,219 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_enumeration_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+#include "cobalt/bindings/testing/test_enum.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::EnumerationInterface;
+using cobalt::bindings::testing::V8cEnumerationInterface;
+using cobalt::bindings::testing::TestEnum;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void EnumerationInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_enumProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ EnumerationInterface* impl = static_cast<EnumerationInterface*>(wrapper_private->wrappable<EnumerationInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_enumProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ EnumerationInterface* impl = static_cast<EnumerationInterface*>(wrapper_private->wrappable<EnumerationInterface>());
+
+ TypeTraits<TestEnum>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_enum_property(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "EnumerationInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "enumProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_enumProperty
+ ,v8cSet_enumProperty
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "optionalEnumWithDefault",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 19;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cEnumerationInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cEnumerationInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_enumeration_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_enumeration_interface.h
new file mode 100644
index 0000000..f83a0e4
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_enumeration_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cEnumerationInterface_h
+#define V8cEnumerationInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/enumeration_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cEnumerationInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cEnumerationInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_exception_object_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_exception_object_interface.cc
new file mode 100644
index 0000000..93e2870
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_exception_object_interface.cc
@@ -0,0 +1,212 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_exception_object_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::ExceptionObjectInterface;
+using cobalt::bindings::testing::V8cExceptionObjectInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void ExceptionObjectInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_error(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ExceptionObjectInterface* impl = static_cast<ExceptionObjectInterface*>(wrapper_private->wrappable<ExceptionObjectInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void v8cGet_message(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ExceptionObjectInterface* impl = static_cast<ExceptionObjectInterface*>(wrapper_private->wrappable<ExceptionObjectInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "ExceptionObjectInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "error",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_error
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "message",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_message
+ );
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 20;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cExceptionObjectInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cExceptionObjectInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_exception_object_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_exception_object_interface.h
new file mode 100644
index 0000000..4b31a28
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_exception_object_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cExceptionObjectInterface_h
+#define V8cExceptionObjectInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/exception_object_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cExceptionObjectInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cExceptionObjectInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_exceptions_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_exceptions_interface.cc
new file mode 100644
index 0000000..d668a39
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_exceptions_interface.cc
@@ -0,0 +1,219 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_exceptions_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::ExceptionsInterface;
+using cobalt::bindings::testing::V8cExceptionsInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void ExceptionsInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_attributeThrowsException(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ExceptionsInterface* impl = static_cast<ExceptionsInterface*>(wrapper_private->wrappable<ExceptionsInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_attributeThrowsException(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ExceptionsInterface* impl = static_cast<ExceptionsInterface*>(wrapper_private->wrappable<ExceptionsInterface>());
+
+ TypeTraits<bool>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ V8cExceptionState exception;
+ impl->set_attribute_throws_exception(
+ conversion_value
+ ,&exception
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "ExceptionsInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "attributeThrowsException",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_attributeThrowsException
+ ,v8cSet_attributeThrowsException
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "functionThrowsException",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 21;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cExceptionsInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cExceptionsInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_exceptions_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_exceptions_interface.h
new file mode 100644
index 0000000..e34dfb1
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_exceptions_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cExceptionsInterface_h
+#define V8cExceptionsInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/exceptions_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cExceptionsInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cExceptionsInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_extended_idl_attributes_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_extended_idl_attributes_interface.cc
new file mode 100644
index 0000000..1f7f07c
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_extended_idl_attributes_interface.cc
@@ -0,0 +1,224 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_extended_idl_attributes_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::ExtendedIDLAttributesInterface;
+using cobalt::bindings::testing::V8cExtendedIDLAttributesInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void ExtendedIDLAttributesInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_default(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ExtendedIDLAttributesInterface* impl = static_cast<ExtendedIDLAttributesInterface*>(wrapper_private->wrappable<ExtendedIDLAttributesInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_default(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ ExtendedIDLAttributesInterface* impl = static_cast<ExtendedIDLAttributesInterface*>(wrapper_private->wrappable<ExtendedIDLAttributesInterface>());
+
+ TypeTraits<bool>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_attribute_default(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "ExtendedIDLAttributesInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "default",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_default
+ ,v8cSet_default
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "callWithSettings",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "clampArgument",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 22;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cExtendedIDLAttributesInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cExtendedIDLAttributesInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_extended_idl_attributes_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_extended_idl_attributes_interface.h
new file mode 100644
index 0000000..6a70006
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_extended_idl_attributes_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cExtendedIDLAttributesInterface_h
+#define V8cExtendedIDLAttributesInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/extended_idl_attributes_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cExtendedIDLAttributesInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cExtendedIDLAttributesInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_garbage_collection_test_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_garbage_collection_test_interface.cc
new file mode 100644
index 0000000..414e1c2
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_garbage_collection_test_interface.cc
@@ -0,0 +1,254 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_garbage_collection_test_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+#include "cobalt/bindings/testing/garbage_collection_test_interface.h"
+#include "cobalt/bindings/testing/v8c_garbage_collection_test_interface.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::GarbageCollectionTestInterface;
+using cobalt::bindings::testing::V8cGarbageCollectionTestInterface;
+using cobalt::bindings::testing::GarbageCollectionTestInterface;
+using cobalt::bindings::testing::V8cGarbageCollectionTestInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void GarbageCollectionTestInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_previous(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ GarbageCollectionTestInterface* impl = static_cast<GarbageCollectionTestInterface*>(wrapper_private->wrappable<GarbageCollectionTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_previous(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ GarbageCollectionTestInterface* impl = static_cast<GarbageCollectionTestInterface*>(wrapper_private->wrappable<GarbageCollectionTestInterface>());
+
+ TypeTraits<scoped_refptr<GarbageCollectionTestInterface>>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagNullable), &exception_state, &conversion_value);
+ impl->set_previous(
+ conversion_value
+ );
+}
+
+
+
+void v8cGet_next(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ GarbageCollectionTestInterface* impl = static_cast<GarbageCollectionTestInterface*>(wrapper_private->wrappable<GarbageCollectionTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_next(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ GarbageCollectionTestInterface* impl = static_cast<GarbageCollectionTestInterface*>(wrapper_private->wrappable<GarbageCollectionTestInterface>());
+
+ TypeTraits<scoped_refptr<GarbageCollectionTestInterface>>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagNullable), &exception_state, &conversion_value);
+ impl->set_next(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "GarbageCollectionTestInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "previous",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_previous
+ ,v8cSet_previous
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "next",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_next
+ ,v8cSet_next
+ );
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 23;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cGarbageCollectionTestInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cGarbageCollectionTestInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_garbage_collection_test_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_garbage_collection_test_interface.h
new file mode 100644
index 0000000..5ede33a
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_garbage_collection_test_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cGarbageCollectionTestInterface_h
+#define V8cGarbageCollectionTestInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/garbage_collection_test_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cGarbageCollectionTestInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cGarbageCollectionTestInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_global_interface_parent.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_global_interface_parent.cc
new file mode 100644
index 0000000..9e15781
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_global_interface_parent.cc
@@ -0,0 +1,177 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_global_interface_parent.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::GlobalInterfaceParent;
+using cobalt::bindings::testing::V8cGlobalInterfaceParent;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void GlobalInterfaceParentConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "GlobalInterfaceParent",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "parentOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 24;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cGlobalInterfaceParent::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cGlobalInterfaceParent::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_global_interface_parent.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_global_interface_parent.h
new file mode 100644
index 0000000..1bc768e
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_global_interface_parent.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cGlobalInterfaceParent_h
+#define V8cGlobalInterfaceParent_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/global_interface_parent.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cGlobalInterfaceParent {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cGlobalInterfaceParent_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_indexed_getter_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_indexed_getter_interface.cc
new file mode 100644
index 0000000..a115c90
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_indexed_getter_interface.cc
@@ -0,0 +1,212 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_indexed_getter_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::IndexedGetterInterface;
+using cobalt::bindings::testing::V8cIndexedGetterInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void IndexedGetterInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_length(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ IndexedGetterInterface* impl = static_cast<IndexedGetterInterface*>(wrapper_private->wrappable<IndexedGetterInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "IndexedGetterInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "length",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_length
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "indexedDeleter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "indexedGetter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "indexedSetter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 26;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cIndexedGetterInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cIndexedGetterInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_indexed_getter_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_indexed_getter_interface.h
new file mode 100644
index 0000000..d553d00
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_indexed_getter_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cIndexedGetterInterface_h
+#define V8cIndexedGetterInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/indexed_getter_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cIndexedGetterInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cIndexedGetterInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_any.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_any.cc
new file mode 100644
index 0000000..6f5212a
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_any.cc
@@ -0,0 +1,184 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_interface_with_any.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::InterfaceWithAny;
+using cobalt::bindings::testing::V8cInterfaceWithAny;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void InterfaceWithAnyConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "InterfaceWithAny",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "getAny",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "setAny",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 27;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cInterfaceWithAny::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cInterfaceWithAny::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_any.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_any.h
new file mode 100644
index 0000000..7c75a6b
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_any.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cInterfaceWithAny_h
+#define V8cInterfaceWithAny_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/interface_with_any.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cInterfaceWithAny {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cInterfaceWithAny_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_any_dictionary.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_any_dictionary.cc
new file mode 100644
index 0000000..4a360cc
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_any_dictionary.cc
@@ -0,0 +1,198 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_interface_with_any_dictionary.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::InterfaceWithAnyDictionary;
+using cobalt::bindings::testing::V8cInterfaceWithAnyDictionary;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void InterfaceWithAnyDictionaryConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "InterfaceWithAnyDictionary",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "getAny",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "hasAny",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "hasAnyDefault",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "setAny",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 28;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cInterfaceWithAnyDictionary::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cInterfaceWithAnyDictionary::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_any_dictionary.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_any_dictionary.h
new file mode 100644
index 0000000..b016bb5
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_any_dictionary.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cInterfaceWithAnyDictionary_h
+#define V8cInterfaceWithAnyDictionary_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/interface_with_any_dictionary.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cInterfaceWithAnyDictionary {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cInterfaceWithAnyDictionary_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_unsupported_properties.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_unsupported_properties.cc
new file mode 100644
index 0000000..ea91e2b
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_unsupported_properties.cc
@@ -0,0 +1,191 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_interface_with_unsupported_properties.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::InterfaceWithUnsupportedProperties;
+using cobalt::bindings::testing::V8cInterfaceWithUnsupportedProperties;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void InterfaceWithUnsupportedPropertiesConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_supportedAttribute(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ InterfaceWithUnsupportedProperties* impl = static_cast<InterfaceWithUnsupportedProperties*>(wrapper_private->wrappable<InterfaceWithUnsupportedProperties>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "InterfaceWithUnsupportedProperties",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "supportedAttribute",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_supportedAttribute
+ );
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 29;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cInterfaceWithUnsupportedProperties::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cInterfaceWithUnsupportedProperties::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_unsupported_properties.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_unsupported_properties.h
new file mode 100644
index 0000000..cac9ae8
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_interface_with_unsupported_properties.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cInterfaceWithUnsupportedProperties_h
+#define V8cInterfaceWithUnsupportedProperties_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/interface_with_unsupported_properties.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cInterfaceWithUnsupportedProperties {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cInterfaceWithUnsupportedProperties_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_constructor_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_constructor_interface.cc
new file mode 100644
index 0000000..ccb2242
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_constructor_interface.cc
@@ -0,0 +1,170 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_named_constructor_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::NamedConstructorInterface;
+using cobalt::bindings::testing::V8cNamedConstructorInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void NamedConstructorInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "NamedConstructorInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 30;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cNamedConstructorInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cNamedConstructorInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_constructor_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_constructor_interface.h
new file mode 100644
index 0000000..f871bae
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_constructor_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cNamedConstructorInterface_h
+#define V8cNamedConstructorInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/named_constructor_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cNamedConstructorInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cNamedConstructorInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_getter_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_getter_interface.cc
new file mode 100644
index 0000000..954dec9
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_getter_interface.cc
@@ -0,0 +1,191 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_named_getter_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::NamedGetterInterface;
+using cobalt::bindings::testing::V8cNamedGetterInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void NamedGetterInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "NamedGetterInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "namedDeleter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "namedGetter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "namedSetter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 31;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cNamedGetterInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cNamedGetterInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_getter_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_getter_interface.h
new file mode 100644
index 0000000..18c7957
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_getter_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cNamedGetterInterface_h
+#define V8cNamedGetterInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/named_getter_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cNamedGetterInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cNamedGetterInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_indexed_getter_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_indexed_getter_interface.cc
new file mode 100644
index 0000000..0bce93c
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_indexed_getter_interface.cc
@@ -0,0 +1,266 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_named_indexed_getter_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::NamedIndexedGetterInterface;
+using cobalt::bindings::testing::V8cNamedIndexedGetterInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void NamedIndexedGetterInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_length(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NamedIndexedGetterInterface* impl = static_cast<NamedIndexedGetterInterface*>(wrapper_private->wrappable<NamedIndexedGetterInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+
+void v8cGet_propertyOnBaseClass(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NamedIndexedGetterInterface* impl = static_cast<NamedIndexedGetterInterface*>(wrapper_private->wrappable<NamedIndexedGetterInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_propertyOnBaseClass(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NamedIndexedGetterInterface* impl = static_cast<NamedIndexedGetterInterface*>(wrapper_private->wrappable<NamedIndexedGetterInterface>());
+
+ TypeTraits<bool>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_property_on_base_class(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "NamedIndexedGetterInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "length",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_length
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "propertyOnBaseClass",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_propertyOnBaseClass
+ ,v8cSet_propertyOnBaseClass
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "indexedGetter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "indexedSetter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "namedGetter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "namedSetter",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "operationOnBaseClass",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 32;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cNamedIndexedGetterInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cNamedIndexedGetterInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_indexed_getter_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_indexed_getter_interface.h
new file mode 100644
index 0000000..e921b42
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_named_indexed_getter_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cNamedIndexedGetterInterface_h
+#define V8cNamedIndexedGetterInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/named_indexed_getter_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cNamedIndexedGetterInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cNamedIndexedGetterInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_nested_put_forwards_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_nested_put_forwards_interface.cc
new file mode 100644
index 0000000..56de5d5
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_nested_put_forwards_interface.cc
@@ -0,0 +1,209 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_nested_put_forwards_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+#include "cobalt/bindings/testing/put_forwards_interface.h"
+#include "cobalt/bindings/testing/v8c_put_forwards_interface.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::NestedPutForwardsInterface;
+using cobalt::bindings::testing::V8cNestedPutForwardsInterface;
+using cobalt::bindings::testing::PutForwardsInterface;
+using cobalt::bindings::testing::V8cPutForwardsInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void NestedPutForwardsInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_nestedForwardingAttribute(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NestedPutForwardsInterface* impl = static_cast<NestedPutForwardsInterface*>(wrapper_private->wrappable<NestedPutForwardsInterface>());
+
+ NOTIMPLEMENTED();
+}
+
+
+void v8cSet_nestedForwardingAttribute(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NestedPutForwardsInterface* impl = static_cast<NestedPutForwardsInterface*>(wrapper_private->wrappable<NestedPutForwardsInterface>());
+
+ NOTIMPLEMENTED();
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "NestedPutForwardsInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "nestedForwardingAttribute",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_nestedForwardingAttribute
+ ,v8cSet_nestedForwardingAttribute
+ );
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 33;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cNestedPutForwardsInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cNestedPutForwardsInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_nested_put_forwards_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_nested_put_forwards_interface.h
new file mode 100644
index 0000000..d2f9972
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_nested_put_forwards_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cNestedPutForwardsInterface_h
+#define V8cNestedPutForwardsInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/nested_put_forwards_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cNestedPutForwardsInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cNestedPutForwardsInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_no_constructor_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_no_constructor_interface.cc
new file mode 100644
index 0000000..634eddb
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_no_constructor_interface.cc
@@ -0,0 +1,170 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_no_constructor_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::NoConstructorInterface;
+using cobalt::bindings::testing::V8cNoConstructorInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void NoConstructorInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "NoConstructorInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 34;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cNoConstructorInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cNoConstructorInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_no_constructor_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_no_constructor_interface.h
new file mode 100644
index 0000000..88bb222
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_no_constructor_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cNoConstructorInterface_h
+#define V8cNoConstructorInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/no_constructor_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cNoConstructorInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cNoConstructorInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_no_interface_object_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_no_interface_object_interface.cc
new file mode 100644
index 0000000..35b5038
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_no_interface_object_interface.cc
@@ -0,0 +1,170 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_no_interface_object_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::NoInterfaceObjectInterface;
+using cobalt::bindings::testing::V8cNoInterfaceObjectInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void NoInterfaceObjectInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "NoInterfaceObjectInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 35;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cNoInterfaceObjectInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cNoInterfaceObjectInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_no_interface_object_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_no_interface_object_interface.h
new file mode 100644
index 0000000..49b3f03
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_no_interface_object_interface.h
@@ -0,0 +1,49 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cNoInterfaceObjectInterface_h
+#define V8cNoInterfaceObjectInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/no_interface_object_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cNoInterfaceObjectInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cNoInterfaceObjectInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_nullable_types_test_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_nullable_types_test_interface.cc
new file mode 100644
index 0000000..6108a01
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_nullable_types_test_interface.cc
@@ -0,0 +1,390 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_nullable_types_test_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+#include "cobalt/bindings/testing/arbitrary_interface.h"
+#include "cobalt/bindings/testing/v8c_arbitrary_interface.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::NullableTypesTestInterface;
+using cobalt::bindings::testing::V8cNullableTypesTestInterface;
+using cobalt::bindings::testing::ArbitraryInterface;
+using cobalt::bindings::testing::V8cArbitraryInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void NullableTypesTestInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_nullableBooleanProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NullableTypesTestInterface* impl = static_cast<NullableTypesTestInterface*>(wrapper_private->wrappable<NullableTypesTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_nullableBooleanProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NullableTypesTestInterface* impl = static_cast<NullableTypesTestInterface*>(wrapper_private->wrappable<NullableTypesTestInterface>());
+
+ TypeTraits<base::optional<bool >>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagNullable), &exception_state, &conversion_value);
+ impl->set_nullable_boolean_property(
+ conversion_value
+ );
+}
+
+
+
+void v8cGet_nullableNumericProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NullableTypesTestInterface* impl = static_cast<NullableTypesTestInterface*>(wrapper_private->wrappable<NullableTypesTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_nullableNumericProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NullableTypesTestInterface* impl = static_cast<NullableTypesTestInterface*>(wrapper_private->wrappable<NullableTypesTestInterface>());
+
+ TypeTraits<base::optional<int32_t >>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagNullable), &exception_state, &conversion_value);
+ impl->set_nullable_numeric_property(
+ conversion_value
+ );
+}
+
+
+
+void v8cGet_nullableStringProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NullableTypesTestInterface* impl = static_cast<NullableTypesTestInterface*>(wrapper_private->wrappable<NullableTypesTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_nullableStringProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NullableTypesTestInterface* impl = static_cast<NullableTypesTestInterface*>(wrapper_private->wrappable<NullableTypesTestInterface>());
+
+ TypeTraits<base::optional<std::string >>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagNullable), &exception_state, &conversion_value);
+ impl->set_nullable_string_property(
+ conversion_value
+ );
+}
+
+
+
+void v8cGet_nullableObjectProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NullableTypesTestInterface* impl = static_cast<NullableTypesTestInterface*>(wrapper_private->wrappable<NullableTypesTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_nullableObjectProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NullableTypesTestInterface* impl = static_cast<NullableTypesTestInterface*>(wrapper_private->wrappable<NullableTypesTestInterface>());
+
+ TypeTraits<scoped_refptr<ArbitraryInterface>>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagNullable), &exception_state, &conversion_value);
+ impl->set_nullable_object_property(
+ conversion_value
+ );
+}
+
+
+
+void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ LOG(INFO) << __func__;
+}
+
+void InitializeTemplate(
+ V8cGlobalEnvironment* env,
+ InterfaceData* interface_data) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(
+ isolate);
+ function_template->SetClassName(
+ v8::String::NewFromUtf8(isolate, "NullableTypesTestInterface",
+ v8::NewStringType::kInternalized).ToLocalChecked());
+ v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
+ instance_template->SetInternalFieldCount(1);
+
+ v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
+ prototype_template->SetInternalFieldCount(1);
+
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "nullableBooleanProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_nullableBooleanProperty
+ ,v8cSet_nullableBooleanProperty
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "nullableNumericProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_nullableNumericProperty
+ ,v8cSet_nullableNumericProperty
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "nullableStringProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_nullableStringProperty
+ ,v8cSet_nullableStringProperty
+ );
+ instance_template->SetAccessor(
+ v8::String::NewFromUtf8(isolate, "nullableObjectProperty",
+ v8::NewStringType::kInternalized)
+ .ToLocalChecked(),
+ v8cGet_nullableObjectProperty
+ ,v8cSet_nullableObjectProperty
+ );
+
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "nullableBooleanArgument",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "nullableBooleanOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "nullableNumericArgument",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "nullableNumericOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "nullableObjectArgument",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "nullableObjectOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "nullableStringArgument",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+ instance_template->Set(
+ v8::String::NewFromUtf8(
+ isolate,
+ "nullableStringOperation",
+ v8::NewStringType::kInternalized).ToLocalChecked(),
+ v8::FunctionTemplate::New(isolate, DummyFunction)
+ );
+
+ interface_data->templ.Set(env->isolate(), function_template);
+}
+
+inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) {
+ const int kInterfaceUniqueId = 36;
+ // By convention, the |V8cGlobalEnvironment| that we are associated with
+ // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+ // for it to be there in the first place, and could not have conflicted with
+ // any other interface.
+ return env->GetInterfaceData(kInterfaceUniqueId);
+}
+
+} // namespace
+
+v8::Local<v8::Object> V8cNullableTypesTestInterface::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) {
+ v8::Isolate* isolate = env->isolate();
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::EscapableHandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = env->context();
+ v8::Context::Scope scope(context);
+
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+ DCHECK(!interface_data->templ.IsEmpty());
+
+ v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate);
+ DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1);
+ v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked();
+ DCHECK(object->InternalFieldCount() == 1);
+
+ // |WrapperPrivate|'s lifetime will be managed by V8.
+ new WrapperPrivate(isolate, wrappable, object);
+ return handle_scope.Escape(object);
+}
+
+v8::Local<v8::FunctionTemplate> V8cNullableTypesTestInterface::CreateTemplate(V8cGlobalEnvironment* env) {
+ InterfaceData* interface_data = GetInterfaceData(env);
+ if (interface_data->templ.IsEmpty()) {
+ InitializeTemplate(env, interface_data);
+ }
+
+ return interface_data->templ.Get(env->isolate());
+}
+
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_nullable_types_test_interface.h b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_nullable_types_test_interface.h
new file mode 100644
index 0000000..9acc4f0
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_nullable_types_test_interface.h
@@ -0,0 +1,50 @@
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.h.template
+
+#ifndef V8cNullableTypesTestInterface_h
+#define V8cNullableTypesTestInterface_h
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/bindings/testing/nullable_types_test_interface.h"
+
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "v8/include/v8.h"
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+class V8cNullableTypesTestInterface {
+ public:
+ static v8::Local<v8::Object> CreateWrapper(script::v8c::V8cGlobalEnvironment* env, const scoped_refptr<script::Wrappable>& wrappable);
+ static v8::Local<v8::FunctionTemplate> CreateTemplate(script::v8c::V8cGlobalEnvironment* env);
+ // TODO: Add |GetInterfaceObject|.
+};
+
+} // namespace testing
+} // namespace bindings
+} // namespace cobalt
+
+#endif // V8cNullableTypesTestInterface_h
diff --git a/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_numeric_types_test_interface.cc b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_numeric_types_test_interface.cc
new file mode 100644
index 0000000..d3a3457
--- /dev/null
+++ b/src/cobalt/bindings/generated/v8c/testing/cobalt/bindings/testing/v8c_numeric_types_test_interface.cc
@@ -0,0 +1,1030 @@
+
+
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// clang-format off
+
+// This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY!
+// Auto-generated from template: bindings/v8c/templates/interface.cc.template
+
+#include "cobalt/bindings/testing/v8c_numeric_types_test_interface.h"
+
+#include "base/debug/trace_event.h"
+#include "cobalt/base/polymorphic_downcast.h"
+#include "cobalt/script/global_environment.h"
+#include "cobalt/script/script_value.h"
+#include "cobalt/script/value_handle.h"
+
+#include "v8c_gen_type_conversion.h"
+
+#include "cobalt/script/callback_interface_traits.h"
+#include "cobalt/script/v8c/callback_function_conversion.h"
+#include "cobalt/script/v8c/conversion_helpers.h"
+#include "cobalt/script/v8c/native_promise.h"
+#include "cobalt/script/v8c/type_traits.h"
+#include "cobalt/script/v8c/v8c_callback_function.h"
+#include "cobalt/script/v8c/v8c_callback_interface_holder.h"
+#include "cobalt/script/v8c/v8c_exception_state.h"
+#include "cobalt/script/v8c/v8c_global_environment.h"
+#include "cobalt/script/v8c/v8c_value_handle.h"
+#include "cobalt/script/v8c/wrapper_private.h"
+#include "v8/include/v8.h"
+
+
+namespace {
+using cobalt::bindings::testing::NumericTypesTestInterface;
+using cobalt::bindings::testing::V8cNumericTypesTestInterface;
+using cobalt::script::CallbackInterfaceTraits;
+using cobalt::script::GlobalEnvironment;
+using cobalt::script::ScriptValue;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandle;
+using cobalt::script::ValueHandleHolder;
+using cobalt::script::Wrappable;
+
+using cobalt::script::v8c::FromJSValue;
+using cobalt::script::v8c::InterfaceData;
+using cobalt::script::v8c::kConversionFlagClamped;
+using cobalt::script::v8c::kConversionFlagNullable;
+using cobalt::script::v8c::kConversionFlagRestricted;
+using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
+using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
+using cobalt::script::v8c::kNoConversionFlags;
+using cobalt::script::v8c::TypeTraits;
+using cobalt::script::v8c::V8cExceptionState;
+using cobalt::script::v8c::V8cGlobalEnvironment;
+using cobalt::script::v8c::WrapperFactory;
+using cobalt::script::v8c::WrapperPrivate;
+
+v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) {
+ NOTIMPLEMENTED();
+ return {};
+}
+
+} // namespace
+
+namespace cobalt {
+namespace bindings {
+namespace testing {
+
+
+namespace {
+
+void NumericTypesTestInterfaceConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ NOTIMPLEMENTED();
+ if (!args.IsConstructCall()) {
+ // TODO: Probably throw something here...
+ return;
+ }
+
+ DCHECK(args.This()->InternalFieldCount() == 1);
+ args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr));
+ args.GetReturnValue().Set(args.This());
+}
+
+
+void v8cGet_byteProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NumericTypesTestInterface* impl = static_cast<NumericTypesTestInterface*>(wrapper_private->wrappable<NumericTypesTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_byteProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NumericTypesTestInterface* impl = static_cast<NumericTypesTestInterface*>(wrapper_private->wrappable<NumericTypesTestInterface>());
+
+ TypeTraits<int8_t>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_byte_property(
+ conversion_value
+ );
+}
+
+
+
+void v8cGet_byteClampProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NumericTypesTestInterface* impl = static_cast<NumericTypesTestInterface*>(wrapper_private->wrappable<NumericTypesTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_byteClampProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NumericTypesTestInterface* impl = static_cast<NumericTypesTestInterface*>(wrapper_private->wrappable<NumericTypesTestInterface>());
+
+ TypeTraits<int8_t>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagClamped), &exception_state, &conversion_value);
+ impl->set_byte_clamp_property(
+ conversion_value
+ );
+}
+
+
+
+void v8cGet_octetProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();
+
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NumericTypesTestInterface* impl = static_cast<NumericTypesTestInterface*>(wrapper_private->wrappable<NumericTypesTestInterface>());
+
+ v8::Local<v8::Value> result_value;
+}
+
+
+void v8cSet_octetProperty(
+ v8::Local<v8::String> property,
+ v8::Local<v8::Value> v8_value,
+ const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0));
+ WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value());
+ NumericTypesTestInterface* impl = static_cast<NumericTypesTestInterface*>(wrapper_private->wrappable<NumericTypesTestInterface>());
+
+ TypeTraits<uint8_t>::ConversionType conversion_value;
+ V8cExceptionState exception_state{};
+ FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value);
+ impl->set_octet_property(
+ conversion_value
+ );
+}
+
+
+
+void v8cGet_octetClampProperty(
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ NOTIMPLEMENTED();