| OLD | NEW |
| 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/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
| 8 #include "platform/v8_inspector/InjectedScript.h" | 8 #include "platform/v8_inspector/InjectedScript.h" |
| 9 #include "platform/v8_inspector/InspectedContext.h" | 9 #include "platform/v8_inspector/InspectedContext.h" |
| 10 #include "platform/v8_inspector/V8Compat.h" | 10 #include "platform/v8_inspector/V8Compat.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 ConsoleHelper(info).addMessage(ClearMessageType, LogMessageLevel, true, 0); | 329 ConsoleHelper(info).addMessage(ClearMessageType, LogMessageLevel, true, 0); |
| 330 } | 330 } |
| 331 | 331 |
| 332 void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 332 void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 333 { | 333 { |
| 334 ConsoleHelper helper(info); | 334 ConsoleHelper helper(info); |
| 335 | 335 |
| 336 String16 title = helper.firstArgToString(String16()); | 336 String16 title = helper.firstArgToString(String16()); |
| 337 String16 identifier; | 337 String16 identifier; |
| 338 if (title.isEmpty()) { | 338 if (title.isEmpty()) { |
| 339 OwnPtr<V8StackTraceImpl> stackTrace = V8StackTraceImpl::capture(nullptr,
1); | 339 std::unique_ptr<V8StackTraceImpl> stackTrace = V8StackTraceImpl::capture
(nullptr, 1); |
| 340 if (stackTrace) | 340 if (stackTrace) |
| 341 identifier = stackTrace->topSourceURL() + ":" + String16::number(sta
ckTrace->topLineNumber()); | 341 identifier = stackTrace->topSourceURL() + ":" + String16::number(sta
ckTrace->topLineNumber()); |
| 342 } else { | 342 } else { |
| 343 identifier = title + "@"; | 343 identifier = title + "@"; |
| 344 } | 344 } |
| 345 | 345 |
| 346 v8::Local<v8::Map> countMap; | 346 v8::Local<v8::Map> countMap; |
| 347 if (!helper.privateMap("V8Console#countMap").ToLocal(&countMap)) | 347 if (!helper.privateMap("V8Console#countMap").ToLocal(&countMap)) |
| 348 return; | 348 return; |
| 349 int64_t count = helper.getIntFromMap(countMap, identifier, 0) + 1; | 349 int64_t count = helper.getIntFromMap(countMap, identifier, 0) + 1; |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 info.GetReturnValue().Set(info[0]); | 582 info.GetReturnValue().Set(info[0]); |
| 583 | 583 |
| 584 ConsoleHelper helper(info); | 584 ConsoleHelper helper(info); |
| 585 InspectedContext* context = helper.ensureInspectedContext(); | 585 InspectedContext* context = helper.ensureInspectedContext(); |
| 586 if (!context) | 586 if (!context) |
| 587 return; | 587 return; |
| 588 InjectedScript* injectedScript = context->getInjectedScript(); | 588 InjectedScript* injectedScript = context->getInjectedScript(); |
| 589 if (!injectedScript) | 589 if (!injectedScript) |
| 590 return; | 590 return; |
| 591 ErrorString errorString; | 591 ErrorString errorString; |
| 592 OwnPtr<protocol::Runtime::RemoteObject> wrappedObject = injectedScript->wrap
Object(&errorString, info[0], "", false /** forceValueType */, false /** generat
ePreview */); | 592 std::unique_ptr<protocol::Runtime::RemoteObject> wrappedObject = injectedScr
ipt->wrapObject(&errorString, info[0], "", false /** forceValueType */, false /*
* generatePreview */); |
| 593 if (!wrappedObject || !errorString.isEmpty()) | 593 if (!wrappedObject || !errorString.isEmpty()) |
| 594 return; | 594 return; |
| 595 | 595 |
| 596 OwnPtr<protocol::DictionaryValue> hints = protocol::DictionaryValue::create(
); | 596 std::unique_ptr<protocol::DictionaryValue> hints = protocol::DictionaryValue
::create(); |
| 597 if (copyToClipboard) | 597 if (copyToClipboard) |
| 598 hints->setBoolean("copyToClipboard", true); | 598 hints->setBoolean("copyToClipboard", true); |
| 599 if (V8InspectorSessionImpl* session = helper.currentSession()) | 599 if (V8InspectorSessionImpl* session = helper.currentSession()) |
| 600 session->runtimeAgent()->inspect(std::move(wrappedObject), std::move(hin
ts)); | 600 session->runtimeAgent()->inspect(std::move(wrappedObject), std::move(hin
ts)); |
| 601 } | 601 } |
| 602 | 602 |
| 603 void V8Console::inspectCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 603 void V8Console::inspectCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 604 { | 604 { |
| 605 inspectImpl(info, false); | 605 inspectImpl(info, false); |
| 606 } | 606 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, getters, ()); | 725 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, getters, ()); |
| 726 if (getters.size() == 0) { | 726 if (getters.size() == 0) { |
| 727 const char* members[] = { "$0", "$1", "$2", "$3", "$4", "$_" }; | 727 const char* members[] = { "$0", "$1", "$2", "$3", "$4", "$_" }; |
| 728 for (size_t i = 0; i < WTF_ARRAY_LENGTH(members); ++i) | 728 for (size_t i = 0; i < WTF_ARRAY_LENGTH(members); ++i) |
| 729 getters.add(members[i]); | 729 getters.add(members[i]); |
| 730 } | 730 } |
| 731 return getters.find(name) != getters.end(); | 731 return getters.find(name) != getters.end(); |
| 732 } | 732 } |
| 733 | 733 |
| 734 } // namespace blink | 734 } // namespace blink |
| OLD | NEW |