Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1275)

Side by Side Diff: Source/bindings/modules/v8/ModuleBindingsInitializer.cpp

Issue 551003002: bindings: Removes unnecessary Event-related code. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Pushed V8EventTargetCustom.cpp back with modification. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/modules/generated.gyp ('k') | Source/build/scripts/make_event_factory.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "core/dom/ExecutionContext.h"
10 #include "bindings/core/v8/V8EventTarget.h"
11 #include "modules/EventModulesHeaders.h"
12 #include "modules/EventModulesInterfaces.h"
13 #include "modules/EventTargetModulesHeaders.h"
14 #include "modules/EventTargetModulesInterfaces.h"
15 #include "modules/indexeddb/IDBPendingTransactionMonitor.h" 10 #include "modules/indexeddb/IDBPendingTransactionMonitor.h"
16 11
17 namespace blink { 12 namespace blink {
18 13
19 #define TRY_TO_WRAP_WITH_INTERFACE(interfaceName) \
20 if (EventNames::interfaceName == desiredInterface) \
21 return wrap(static_cast<interfaceName*>(event), creationContext, isolate );
22
23 static v8::Handle<v8::Object> wrapForModuleEvent(Event* event, v8::Handle<v8::Ob ject> creationContext, v8::Isolate *isolate)
24 {
25 ASSERT(event);
26
27 String desiredInterface = event->interfaceName();
28 EVENT_MODULES_INTERFACES_FOR_EACH(TRY_TO_WRAP_WITH_INTERFACE);
29
30 // Wrapping for core event types should have been tried before this
31 // function was called, so |event| should have been a module event type.
32 // If this ASSERT is hit, the event type was missing from both
33 // enumerations.
34 ASSERT_NOT_REACHED();
35 return v8::Handle<v8::Object>();
36 }
37
38 #undef TRY_TO_WRAP_WITH_INTERFACE
39
40 #define TRY_TO_TOV8_WITH_INTERFACE(interfaceName) \
41 if (EventTargetNames::interfaceName == desiredInterface) \
42 return toV8(static_cast<interfaceName*>(impl), creationContext, isolate) ;
43
44 static v8::Handle<v8::Value> toV8ForModuleEventTarget(EventTarget* impl, v8::Han dle<v8::Object> creationContext, v8::Isolate* isolate)
45 {
46 ASSERT(impl);
47 AtomicString desiredInterface = impl->interfaceName();
48 EVENT_TARGET_MODULES_INTERFACES_FOR_EACH(TRY_TO_TOV8_WITH_INTERFACE)
49
50 ASSERT_NOT_REACHED();
51 return v8Undefined();
52 }
53
54 #undef TRY_TO_TOV8_WITH_INTERFACE
55
56 static void didLeaveScriptContextForModule(ExecutionContext& executionContext) 14 static void didLeaveScriptContextForModule(ExecutionContext& executionContext)
57 { 15 {
58 // Indexed DB requires that transactions are created with an internal |activ e| flag 16 // Indexed DB requires that transactions are created with an internal |activ e| flag
59 // set to true, but the flag becomes false when control returns to the event loop. 17 // set to true, but the flag becomes false when control returns to the event loop.
60 IDBPendingTransactionMonitor::from(executionContext).deactivateNewTransactio ns(); 18 IDBPendingTransactionMonitor::from(executionContext).deactivateNewTransactio ns();
61 } 19 }
62 20
63 void ModuleBindingsInitializer::init() 21 void ModuleBindingsInitializer::init()
64 { 22 {
65 ModuleProxy::moduleProxy().registerWrapForEvent(wrapForModuleEvent);
66 ModuleProxy::moduleProxy().registerToV8ForEventTarget(toV8ForModuleEventTarg et);
67 ModuleProxy::moduleProxy().registerDidLeaveScriptContextForRecursionScope(di dLeaveScriptContextForModule); 23 ModuleProxy::moduleProxy().registerDidLeaveScriptContextForRecursionScope(di dLeaveScriptContextForModule);
68 } 24 }
69 25
70 } // namespace blink 26 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/modules/generated.gyp ('k') | Source/build/scripts/make_event_factory.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698