Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // FIXME: Remove this file once iterator is correctly handled in the code | |
| 6 // generator. | |
|
abarth-chromium
2014/08/20 18:22:42
Please don't introduce any custom bindings for Int
yhirano
2014/08/21 11:55:27
Removed the custom wrapper.
| |
| 7 | |
| 8 #include "config.h" | |
| 9 #include "bindings/core/v8/V8Internals.h" | |
| 10 | |
| 11 #include "bindings/core/v8/V8DOMConfiguration.h" | |
| 12 #include "bindings/core/v8/V8Iterator.h" | |
| 13 #include "core/dom/Iterator.h" | |
| 14 #include "platform/TraceEvent.h" | |
| 15 | |
| 16 namespace blink { | |
| 17 | |
| 18 static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 19 { | |
| 20 ExceptionState exceptionState(ExceptionState::ExecutionContext, "read", "Rea dableStream", info.Holder(), info.GetIsolate()); | |
| 21 Internals* impl = V8Internals::toNative(info.Holder()); | |
| 22 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | |
| 23 Iterator* result = impl->iterator(scriptState, exceptionState); | |
| 24 if (exceptionState.hadException()) { | |
| 25 exceptionState.throwIfNeeded(); | |
| 26 return; | |
| 27 } | |
| 28 v8SetReturnValue(info, toV8(result, info.Holder(), info.GetIsolate())); | |
| 29 } | |
| 30 | |
| 31 static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo) | |
| 32 { | |
| 33 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 34 iteratorMethod(info); | |
| 35 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 36 } | |
| 37 | |
| 38 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration iteratorConfigur ation = { | |
| 39 v8::Symbol::GetIterator, iteratorMethodCallback, 0, 0, V8DOMConfiguration::E xposedToAllScripts | |
| 40 }; | |
| 41 | |
| 42 v8::Handle<v8::Object> wrap(Internals* impl, v8::Handle<v8::Object> creationCont ext, v8::Isolate* isolate) | |
| 43 { | |
| 44 ASSERT(impl); | |
| 45 v8::Handle<v8::Object> wrapper = V8Internals::createWrapper(impl, creationCo ntext, isolate); | |
| 46 | |
| 47 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, V8Internals ::domTemplate(isolate)); | |
| 48 V8DOMConfiguration::installMethod(wrapper, signature, v8::DontDelete, iterat orConfiguration, isolate); | |
| 49 return wrapper; | |
| 50 } | |
| 51 | |
| 52 } // namespace blink | |
| 53 | |
| OLD | NEW |