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

Side by Side Diff: third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp

Issue 2139393002: Revert of Remove constructor from remaining functions that aren't constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "core/inspector/ThreadDebugger.h" 5 #include "core/inspector/ThreadDebugger.h"
6 6
7 #include "bindings/core/v8/ScriptValue.h" 7 #include "bindings/core/v8/ScriptValue.h"
8 #include "bindings/core/v8/V8Binding.h" 8 #include "bindings/core/v8/V8Binding.h"
9 #include "bindings/core/v8/V8DOMException.h" 9 #include "bindings/core/v8/V8DOMException.h"
10 #include "bindings/core/v8/V8DOMTokenList.h" 10 #include "bindings/core/v8/V8DOMTokenList.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 static void returnDataCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 167 static void returnDataCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
168 { 168 {
169 info.GetReturnValue().Set(info.Data()); 169 info.GetReturnValue().Set(info.Data());
170 } 170 }
171 171
172 void ThreadDebugger::createFunctionProperty(v8::Local<v8::Context> context, v8:: Local<v8::Object> object, const char* name, v8::FunctionCallback callback, const char* description) 172 void ThreadDebugger::createFunctionProperty(v8::Local<v8::Context> context, v8:: Local<v8::Object> object, const char* name, v8::FunctionCallback callback, const char* description)
173 { 173 {
174 v8::Local<v8::String> funcName = v8String(context->GetIsolate(), name); 174 v8::Local<v8::String> funcName = v8String(context->GetIsolate(), name);
175 v8::Local<v8::Function> func; 175 v8::Local<v8::Function> func;
176 if (!v8::Function::New(context, callback, v8::External::New(context->GetIsol ate(), this), 0, v8::ConstructorBehavior::kThrow).ToLocal(&func)) 176 if (!v8::Function::New(context, callback, v8::External::New(context->GetIsol ate(), this)).ToLocal(&func))
177 return; 177 return;
178 func->SetName(funcName); 178 func->SetName(funcName);
179 v8::Local<v8::String> returnValue = v8String(context->GetIsolate(), descript ion); 179 v8::Local<v8::String> returnValue = v8String(context->GetIsolate(), descript ion);
180 v8::Local<v8::Function> toStringFunction; 180 v8::Local<v8::Function> toStringFunction;
181 if (v8::Function::New(context, returnDataCallback, returnValue, 0, v8::Const ructorBehavior::kThrow).ToLocal(&toStringFunction)) 181 if (v8::Function::New(context, returnDataCallback, returnValue).ToLocal(&toS tringFunction))
182 func->Set(v8String(context->GetIsolate(), "toString"), toStringFunction) ; 182 func->Set(v8String(context->GetIsolate(), "toString"), toStringFunction) ;
183 if (!object->Set(context, funcName, func).FromMaybe(false)) 183 if (!object->Set(context, funcName, func).FromMaybe(false))
184 return; 184 return;
185 } 185 }
186 186
187 void ThreadDebugger::installAdditionalCommandLineAPI(v8::Local<v8::Context> cont ext, v8::Local<v8::Object> object) 187 void ThreadDebugger::installAdditionalCommandLineAPI(v8::Local<v8::Context> cont ext, v8::Local<v8::Object> object)
188 { 188 {
189 createFunctionProperty(context, object, "monitorEvents", ThreadDebugger::mon itorEventsCallback, "function monitorEvents(object, [types]) { [Command Line API ] }"); 189 createFunctionProperty(context, object, "monitorEvents", ThreadDebugger::mon itorEventsCallback, "function monitorEvents(object, [types]) { [Command Line API ] }");
190 createFunctionProperty(context, object, "unmonitorEvents", ThreadDebugger::u nmonitorEventsCallback, "function unmonitorEvents(object, [types]) { [Command Li ne API] }"); 190 createFunctionProperty(context, object, "unmonitorEvents", ThreadDebugger::u nmonitorEventsCallback, "function unmonitorEvents(object, [types]) { [Command Li ne API] }");
191 createFunctionProperty(context, object, "getEventListeners", ThreadDebugger: :getEventListenersCallback, "function getEventListeners(node) { [Command Line AP I] }"); 191 createFunctionProperty(context, object, "getEventListeners", ThreadDebugger: :getEventListenersCallback, "function getEventListeners(node) { [Command Line AP I] }");
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 DCHECK(debugger); 234 DCHECK(debugger);
235 Event* event = V8Event::toImplWithTypeCheck(info.GetIsolate(), info[0]); 235 Event* event = V8Event::toImplWithTypeCheck(info.GetIsolate(), info[0]);
236 if (!event) 236 if (!event)
237 return; 237 return;
238 debugger->debugger()->logToConsole(info.GetIsolate()->GetCurrentContext(), e vent->type(), v8String(info.GetIsolate(), event->type()), info[0]); 238 debugger->debugger()->logToConsole(info.GetIsolate()->GetCurrentContext(), e vent->type(), v8String(info.GetIsolate(), event->type()), info[0]);
239 } 239 }
240 240
241 v8::Local<v8::Function> ThreadDebugger::eventLogFunction() 241 v8::Local<v8::Function> ThreadDebugger::eventLogFunction()
242 { 242 {
243 if (m_eventLogFunction.IsEmpty()) 243 if (m_eventLogFunction.IsEmpty())
244 m_eventLogFunction.Reset(m_isolate, v8::Function::New(m_isolate->GetCurr entContext(), logCallback, v8::External::New(m_isolate, this), 0, v8::Constructo rBehavior::kThrow).ToLocalChecked()); 244 m_eventLogFunction.Reset(m_isolate, v8::Function::New(m_isolate, logCall back, v8::External::New(m_isolate, this)));
245 return m_eventLogFunction.Get(m_isolate); 245 return m_eventLogFunction.Get(m_isolate);
246 } 246 }
247 247
248 static EventTarget* firstArgumentAsEventTarget(const v8::FunctionCallbackInfo<v8 ::Value>& info) 248 static EventTarget* firstArgumentAsEventTarget(const v8::FunctionCallbackInfo<v8 ::Value>& info)
249 { 249 {
250 if (info.Length() < 1) 250 if (info.Length() < 1)
251 return nullptr; 251 return nullptr;
252 if (EventTarget* target = V8EventTarget::toImplWithTypeCheck(info.GetIsolate (), info[0])) 252 if (EventTarget* target = V8EventTarget::toImplWithTypeCheck(info.GetIsolate (), info[0]))
253 return target; 253 return target;
254 return toDOMWindow(info.GetIsolate(), info[0]); 254 return toDOMWindow(info.GetIsolate(), info[0]);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 { 372 {
373 for (size_t index = 0; index < m_timers.size(); ++index) { 373 for (size_t index = 0; index < m_timers.size(); ++index) {
374 if (m_timers[index].get() == timer) { 374 if (m_timers[index].get() == timer) {
375 m_timerCallbacks[index](m_timerData[index]); 375 m_timerCallbacks[index](m_timerData[index]);
376 return; 376 return;
377 } 377 }
378 } 378 }
379 } 379 }
380 380
381 } // namespace blink 381 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698