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

Side by Side Diff: Source/bindings/core/v8/V8AbstractEventListener.h

Issue 638813002: Replace FINAL and OVERRIDE with their C++11 counterparts in Source/bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/bindings/core/v8/SerializedScriptValue.cpp ('k') | Source/bindings/core/v8/V8Binding.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 : 0; 61 : 0;
62 } 62 }
63 63
64 static V8AbstractEventListener* cast(EventListener* listener) 64 static V8AbstractEventListener* cast(EventListener* listener)
65 { 65 {
66 return const_cast<V8AbstractEventListener*>(cast(const_cast<const EventL istener*>(listener))); 66 return const_cast<V8AbstractEventListener*>(cast(const_cast<const EventL istener*>(listener)));
67 } 67 }
68 68
69 // Implementation of EventListener interface. 69 // Implementation of EventListener interface.
70 70
71 virtual bool operator==(const EventListener& other) OVERRIDE { return this = = &other; } 71 virtual bool operator==(const EventListener& other) override { return this = = &other; }
72 72
73 virtual void handleEvent(ExecutionContext*, Event*) OVERRIDE; 73 virtual void handleEvent(ExecutionContext*, Event*) override;
74 74
75 virtual bool isLazy() const { return false; } 75 virtual bool isLazy() const { return false; }
76 76
77 // Returns the listener object, either a function or an object. 77 // Returns the listener object, either a function or an object.
78 v8::Local<v8::Object> getListenerObject(ExecutionContext* context) 78 v8::Local<v8::Object> getListenerObject(ExecutionContext* context)
79 { 79 {
80 // prepareListenerObject can potentially deref this event listener 80 // prepareListenerObject can potentially deref this event listener
81 // as it may attempt to compile a function (lazy event listener), get an error 81 // as it may attempt to compile a function (lazy event listener), get an error
82 // and invoke onerror callback which can execute arbitrary JS code. 82 // and invoke onerror callback which can execute arbitrary JS code.
83 // Protect this event listener to keep it alive. 83 // Protect this event listener to keep it alive.
(...skipping 17 matching lines...) Expand all
101 bool hasExistingListenerObject() 101 bool hasExistingListenerObject()
102 { 102 {
103 return !m_listener.isEmpty(); 103 return !m_listener.isEmpty();
104 } 104 }
105 105
106 void clearListenerObject() 106 void clearListenerObject()
107 { 107 {
108 m_listener.clear(); 108 m_listener.clear();
109 } 109 }
110 110
111 virtual bool belongsToTheCurrentWorld() const OVERRIDE FINAL; 111 virtual bool belongsToTheCurrentWorld() const override final;
112 v8::Isolate* isolate() const { return m_isolate; } 112 v8::Isolate* isolate() const { return m_isolate; }
113 virtual DOMWrapperWorld& world() const { return scriptState()->world(); } 113 virtual DOMWrapperWorld& world() const { return scriptState()->world(); }
114 ScriptState* scriptState() const 114 ScriptState* scriptState() const
115 { 115 {
116 ASSERT(m_scriptState); 116 ASSERT(m_scriptState);
117 return m_scriptState.get(); 117 return m_scriptState.get();
118 } 118 }
119 void setScriptState(ScriptState* scriptState) { m_scriptState = scriptState; } 119 void setScriptState(ScriptState* scriptState) { m_scriptState = scriptState; }
120 120
121 protected: 121 protected:
122 V8AbstractEventListener(bool isAttribute, ScriptState*); 122 V8AbstractEventListener(bool isAttribute, ScriptState*);
123 V8AbstractEventListener(bool isAttribute, v8::Isolate*); 123 V8AbstractEventListener(bool isAttribute, v8::Isolate*);
124 124
125 virtual void prepareListenerObject(ExecutionContext*) { } 125 virtual void prepareListenerObject(ExecutionContext*) { }
126 126
127 void setListenerObject(v8::Handle<v8::Object>); 127 void setListenerObject(v8::Handle<v8::Object>);
128 128
129 void invokeEventHandler(Event*, v8::Local<v8::Value> jsEvent); 129 void invokeEventHandler(Event*, v8::Local<v8::Value> jsEvent);
130 130
131 // Get the receiver object to use for event listener call. 131 // Get the receiver object to use for event listener call.
132 v8::Local<v8::Object> getReceiverObject(Event*); 132 v8::Local<v8::Object> getReceiverObject(Event*);
133 133
134 private: 134 private:
135 // Implementation of EventListener function. 135 // Implementation of EventListener function.
136 virtual bool virtualisAttribute() const OVERRIDE { return m_isAttribute; } 136 virtual bool virtualisAttribute() const override { return m_isAttribute; }
137 137
138 virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsev ent, Event*) = 0; 138 virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsev ent, Event*) = 0;
139 139
140 virtual bool shouldPreventDefault(v8::Local<v8::Value> returnValue); 140 virtual bool shouldPreventDefault(v8::Local<v8::Value> returnValue);
141 141
142 static void setWeakCallback(const v8::WeakCallbackData<v8::Object, V8Abstrac tEventListener>&); 142 static void setWeakCallback(const v8::WeakCallbackData<v8::Object, V8Abstrac tEventListener>&);
143 143
144 ScopedPersistent<v8::Object> m_listener; 144 ScopedPersistent<v8::Object> m_listener;
145 145
146 // Indicates if this is an HTML type listener. 146 // Indicates if this is an HTML type listener.
147 bool m_isAttribute; 147 bool m_isAttribute;
148 148
149 // For V8LazyEventListener, m_scriptState can be 0 until V8LazyEventListener is actually used. 149 // For V8LazyEventListener, m_scriptState can be 0 until V8LazyEventListener is actually used.
150 // m_scriptState is set lazily because V8LazyEventListener doesn't know the associated frame 150 // m_scriptState is set lazily because V8LazyEventListener doesn't know the associated frame
151 // until the listener is actually used. 151 // until the listener is actually used.
152 RefPtr<ScriptState> m_scriptState; 152 RefPtr<ScriptState> m_scriptState;
153 v8::Isolate* m_isolate; 153 v8::Isolate* m_isolate;
154 }; 154 };
155 155
156 } // namespace blink 156 } // namespace blink
157 157
158 #endif // V8AbstractEventListener_h 158 #endif // V8AbstractEventListener_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/SerializedScriptValue.cpp ('k') | Source/bindings/core/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698