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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp

Issue 2235753003: [DevTools] Older V8 compatibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 "platform/v8_inspector/V8Console.h" 5 #include "platform/v8_inspector/V8Console.h"
6 6
7 #include "platform/inspector_protocol/Platform.h" 7 #include "platform/inspector_protocol/Platform.h"
8 #include "platform/inspector_protocol/String16.h" 8 #include "platform/inspector_protocol/String16.h"
9 #include "platform/v8_inspector/InjectedScript.h" 9 #include "platform/v8_inspector/InjectedScript.h"
10 #include "platform/v8_inspector/InspectedContext.h" 10 #include "platform/v8_inspector/InspectedContext.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 void returnDataCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 265 void returnDataCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
266 { 266 {
267 info.GetReturnValue().Set(info.Data()); 267 info.GetReturnValue().Set(info.Data());
268 } 268 }
269 269
270 void createBoundFunctionProperty(v8::Local<v8::Context> context, v8::Local<v8::O bject> console, const char* name, v8::FunctionCallback callback, const char* des cription = nullptr) 270 void createBoundFunctionProperty(v8::Local<v8::Context> context, v8::Local<v8::O bject> console, const char* name, v8::FunctionCallback callback, const char* des cription = nullptr)
271 { 271 {
272 v8::Local<v8::String> funcName = toV8StringInternalized(context->GetIsolate( ), name); 272 v8::Local<v8::String> funcName = toV8StringInternalized(context->GetIsolate( ), name);
273 v8::Local<v8::Function> func; 273 v8::Local<v8::Function> func;
274 if (!v8::Function::New(context, callback, console, 0, v8::ConstructorBehavio r::kThrow).ToLocal(&func)) 274 if (!V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, callback, console, 0).ToLocal (&func))
275 return; 275 return;
276 func->SetName(funcName); 276 func->SetName(funcName);
277 if (description) { 277 if (description) {
278 v8::Local<v8::String> returnValue = toV8String(context->GetIsolate(), de scription); 278 v8::Local<v8::String> returnValue = toV8String(context->GetIsolate(), de scription);
279 v8::Local<v8::Function> toStringFunction; 279 v8::Local<v8::Function> toStringFunction;
280 if (v8::Function::New(context, returnDataCallback, returnValue, 0, v8::C onstructorBehavior::kThrow).ToLocal(&toStringFunction)) 280 if (V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, returnDataCallback, return Value, 0).ToLocal(&toStringFunction))
281 func->Set(toV8StringInternalized(context->GetIsolate(), "toString"), toStringFunction); 281 func->Set(toV8StringInternalized(context->GetIsolate(), "toString"), toStringFunction);
282 } 282 }
283 if (!console->Set(context, funcName, func).FromMaybe(false)) 283 if (!console->Set(context, funcName, func).FromMaybe(false))
284 return; 284 return;
285 } 285 }
286 286
287 } // namespace 287 } // namespace
288 288
289 void V8Console::debugCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 289 void V8Console::debugCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
290 { 290 {
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 createBoundFunctionProperty(context, console, "timeline", V8Console::timelin eCallback); 683 createBoundFunctionProperty(context, console, "timeline", V8Console::timelin eCallback);
684 createBoundFunctionProperty(context, console, "timelineEnd", V8Console::time lineEndCallback); 684 createBoundFunctionProperty(context, console, "timelineEnd", V8Console::time lineEndCallback);
685 createBoundFunctionProperty(context, console, "time", V8Console::timeCallbac k); 685 createBoundFunctionProperty(context, console, "time", V8Console::timeCallbac k);
686 createBoundFunctionProperty(context, console, "timeEnd", V8Console::timeEndC allback); 686 createBoundFunctionProperty(context, console, "timeEnd", V8Console::timeEndC allback);
687 createBoundFunctionProperty(context, console, "timeStamp", V8Console::timeSt ampCallback); 687 createBoundFunctionProperty(context, console, "timeStamp", V8Console::timeSt ampCallback);
688 688
689 bool success = console->SetPrototype(context, v8::Object::New(isolate)).From Maybe(false); 689 bool success = console->SetPrototype(context, v8::Object::New(isolate)).From Maybe(false);
690 DCHECK(success); 690 DCHECK(success);
691 691
692 if (hasMemoryAttribute) 692 if (hasMemoryAttribute)
693 console->SetAccessorProperty(toV8StringInternalized(isolate, "memory"), v8::Function::New(context, V8Console::memoryGetterCallback, console, 0, v8::Cons tructorBehavior::kThrow).ToLocalChecked(), v8::Function::New(context, V8Console: :memorySetterCallback, v8::Local<v8::Value>(), 0, v8::ConstructorBehavior::kThro w).ToLocalChecked(), static_cast<v8::PropertyAttribute>(v8::None), v8::DEFAULT); 693 console->SetAccessorProperty(toV8StringInternalized(isolate, "memory"), V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, V8Console::memoryGetterCallback, conso le, 0).ToLocalChecked(), V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, V8Console::me morySetterCallback, v8::Local<v8::Value>(), 0).ToLocalChecked(), static_cast<v8: :PropertyAttribute>(v8::None), v8::DEFAULT);
694 694
695 console->SetPrivate(context, inspectedContextPrivateKey(isolate), v8::Extern al::New(isolate, inspectedContext)); 695 console->SetPrivate(context, inspectedContextPrivateKey(isolate), v8::Extern al::New(isolate, inspectedContext));
696 return console; 696 return console;
697 } 697 }
698 698
699 void V8Console::clearInspectedContextIfNeeded(v8::Local<v8::Context> context, v8 ::Local<v8::Object> console) 699 void V8Console::clearInspectedContextIfNeeded(v8::Local<v8::Context> context, v8 ::Local<v8::Object> console)
700 { 700 {
701 v8::Isolate* isolate = context->GetIsolate(); 701 v8::Isolate* isolate = context->GetIsolate();
702 console->SetPrivate(context, inspectedContextPrivateKey(isolate), v8::Extern al::New(isolate, nullptr)); 702 console->SetPrivate(context, inspectedContextPrivateKey(isolate), v8::Extern al::New(isolate, nullptr));
703 } 703 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 continue; 823 continue;
824 if (name->IsString()) { 824 if (name->IsString()) {
825 v8::Local<v8::Value> descriptor; 825 v8::Local<v8::Value> descriptor;
826 bool success = m_global->GetOwnPropertyDescriptor(m_context, v8::Loc al<v8::String>::Cast(name)).ToLocal(&descriptor); 826 bool success = m_global->GetOwnPropertyDescriptor(m_context, v8::Loc al<v8::String>::Cast(name)).ToLocal(&descriptor);
827 DCHECK(success); 827 DCHECK(success);
828 } 828 }
829 } 829 }
830 } 830 }
831 831
832 } // namespace blink 832 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698