| 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 | 16 |
| 16 namespace WebCore { | 17 namespace WebCore { |
| 17 | 18 |
| 18 #define TRY_TO_WRAP_WITH_INTERFACE(interfaceName) \ | 19 #define TRY_TO_WRAP_WITH_INTERFACE(interfaceName) \ |
| 19 if (EventNames::interfaceName == desiredInterface) \ | 20 if (EventNames::interfaceName == desiredInterface) \ |
| 20 return wrap(static_cast<interfaceName*>(event), creationContext, isolate
); | 21 return wrap(static_cast<interfaceName*>(event), creationContext, isolate
); |
| 21 | 22 |
| 22 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) |
| 23 { | 24 { |
| 24 ASSERT(event); | 25 ASSERT(event); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 ASSERT(impl); | 40 ASSERT(impl); |
| 40 AtomicString desiredInterface = impl->interfaceName(); | 41 AtomicString desiredInterface = impl->interfaceName(); |
| 41 EVENT_TARGET_MODULES_INTERFACES_FOR_EACH(TRY_TO_TOV8_WITH_INTERFACE) | 42 EVENT_TARGET_MODULES_INTERFACES_FOR_EACH(TRY_TO_TOV8_WITH_INTERFACE) |
| 42 | 43 |
| 43 ASSERT_NOT_REACHED(); | 44 ASSERT_NOT_REACHED(); |
| 44 return v8Undefined(); | 45 return v8Undefined(); |
| 45 } | 46 } |
| 46 | 47 |
| 47 #undef TRY_TO_TOV8_WITH_INTERFACE | 48 #undef TRY_TO_TOV8_WITH_INTERFACE |
| 48 | 49 |
| 50 static void didLeaveScriptContextForModule(ExecutionContext& executionContext) |
| 51 { |
| 52 // Indexed DB requires that transactions are created with an internal |activ
e| flag |
| 53 // set to true, but the flag becomes false when control returns to the event
loop. |
| 54 IDBPendingTransactionMonitor::from(executionContext).deactivateNewTransactio
ns(); |
| 55 } |
| 56 |
| 49 void ModuleBindingsInitializer::init() | 57 void ModuleBindingsInitializer::init() |
| 50 { | 58 { |
| 51 ModuleProxy::moduleProxy().registerWrapForEvent(wrapForModuleEvent); | 59 ModuleProxy::moduleProxy().registerWrapForEvent(wrapForModuleEvent); |
| 52 ModuleProxy::moduleProxy().registerToV8ForEventTarget(toV8ForModuleEventTarg
et); | 60 ModuleProxy::moduleProxy().registerToV8ForEventTarget(toV8ForModuleEventTarg
et); |
| 61 ModuleProxy::moduleProxy().registerDidLeaveScriptContextForRecursionScope(di
dLeaveScriptContextForModule); |
| 53 } | 62 } |
| 54 | 63 |
| 55 } // namespace WebCore | 64 } // namespace WebCore |
| OLD | NEW |