Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "bindings/modules/v8/ModuleBindingsInitializer.h" | 6 #include "bindings/modules/v8/ModuleBindingsInitializer.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ModuleProxy.h" | 8 #include "bindings/core/v8/ModuleProxy.h" |
| 9 #include "bindings/core/v8/V8Event.h" | 9 #include "bindings/core/v8/V8Event.h" |
| 10 #include "bindings/core/v8/V8EventTarget.h" | 10 #include "bindings/core/v8/V8EventTarget.h" |
| 11 #include "modules/EventModulesHeaders.h" | 11 #include "modules/EventModulesHeaders.h" |
| 12 #include "modules/EventModulesInterfaces.h" | 12 #include "modules/EventModulesInterfaces.h" |
| 13 #include "modules/EventTargetModulesHeaders.h" | 13 #include "modules/EventTargetModulesHeaders.h" |
| 14 #include "modules/EventTargetModulesInterfaces.h" | 14 #include "modules/EventTargetModulesInterfaces.h" |
| 15 #include "modules/indexeddb/IDBPendingTransactionMonitor.h" | 15 #include "modules/indexeddb/IDBPendingTransactionMonitor.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 #define TRY_TO_WRAP_WITH_INTERFACE(interfaceName) \ | 19 #define TRY_TO_WRAP_WITH_INTERFACE(interfaceName) \ |
| 20 if (EventNames::interfaceName == desiredInterface) \ | 20 if (EventNames::interfaceName == desiredInterface) \ |
| 21 return wrap(static_cast<interfaceName*>(event), creationContext, isolate ); | 21 return wrap(static_cast<interfaceName*>(event), creationContext, isolate ); |
| 22 | 22 |
| 23 static v8::Handle<v8::Object> wrapForModuleEvent(Event* event, v8::Handle<v8::Ob ject> creationContext, v8::Isolate *isolate) | 23 static v8::Handle<v8::Object> wrapForModuleEvent(Event* event, v8::Handle<v8::Ob ject> creationContext, v8::Isolate *isolate) |
| 24 { | 24 { |
| 25 ASSERT(event); | 25 ASSERT(event); |
| 26 | 26 |
| 27 String desiredInterface = event->interfaceName(); | 27 String desiredInterface = event->interfaceName(); |
| 28 EVENT_MODULES_INTERFACES_FOR_EACH(TRY_TO_WRAP_WITH_INTERFACE) | 28 EVENT_MODULES_INTERFACES_FOR_EACH(TRY_TO_WRAP_WITH_INTERFACE) |
| 29 ASSERT_NOT_REACHED(); | |
|
haraken
2014/07/31 16:51:00
Would you add a comment and mention what hitting t
| |
| 29 return v8::Handle<v8::Object>(); | 30 return v8::Handle<v8::Object>(); |
| 30 } | 31 } |
| 31 | 32 |
| 32 #undef TRY_TO_WRAP_WITH_INTERFACE | 33 #undef TRY_TO_WRAP_WITH_INTERFACE |
| 33 | 34 |
| 34 #define TRY_TO_TOV8_WITH_INTERFACE(interfaceName) \ | 35 #define TRY_TO_TOV8_WITH_INTERFACE(interfaceName) \ |
| 35 if (EventTargetNames::interfaceName == desiredInterface) \ | 36 if (EventTargetNames::interfaceName == desiredInterface) \ |
| 36 return toV8(static_cast<interfaceName*>(impl), creationContext, isolate) ; | 37 return toV8(static_cast<interfaceName*>(impl), creationContext, isolate) ; |
| 37 | 38 |
| 38 static v8::Handle<v8::Value> toV8ForModuleEventTarget(EventTarget* impl, v8::Han dle<v8::Object> creationContext, v8::Isolate* isolate) | 39 static v8::Handle<v8::Value> toV8ForModuleEventTarget(EventTarget* impl, v8::Han dle<v8::Object> creationContext, v8::Isolate* isolate) |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 55 } | 56 } |
| 56 | 57 |
| 57 void ModuleBindingsInitializer::init() | 58 void ModuleBindingsInitializer::init() |
| 58 { | 59 { |
| 59 ModuleProxy::moduleProxy().registerWrapForEvent(wrapForModuleEvent); | 60 ModuleProxy::moduleProxy().registerWrapForEvent(wrapForModuleEvent); |
| 60 ModuleProxy::moduleProxy().registerToV8ForEventTarget(toV8ForModuleEventTarg et); | 61 ModuleProxy::moduleProxy().registerToV8ForEventTarget(toV8ForModuleEventTarg et); |
| 61 ModuleProxy::moduleProxy().registerDidLeaveScriptContextForRecursionScope(di dLeaveScriptContextForModule); | 62 ModuleProxy::moduleProxy().registerDidLeaveScriptContextForRecursionScope(di dLeaveScriptContextForModule); |
| 62 } | 63 } |
| 63 | 64 |
| 64 } // namespace blink | 65 } // namespace blink |
| OLD | NEW |