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

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

Issue 2656633004: DevTools: migrate v8 console client to the new API. (Closed)
Patch Set: rebaselined Created 3 years, 10 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 /* 1 /*
2 * Copyright (c) 2011 Google Inc. All rights reserved. 2 * Copyright (c) 2011 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 294 }
295 295
296 void MainThreadDebugger::runIfWaitingForDebugger(int contextGroupId) { 296 void MainThreadDebugger::runIfWaitingForDebugger(int contextGroupId) {
297 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); 297 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
298 if (m_clientMessageLoop) 298 if (m_clientMessageLoop)
299 m_clientMessageLoop->runIfWaitingForDebugger(frame); 299 m_clientMessageLoop->runIfWaitingForDebugger(frame);
300 } 300 }
301 301
302 void MainThreadDebugger::consoleAPIMessage( 302 void MainThreadDebugger::consoleAPIMessage(
303 int contextGroupId, 303 int contextGroupId,
304 v8_inspector::V8ConsoleAPIType type, 304 v8::Isolate::MessageErrorLevel level,
305 const v8_inspector::StringView& message, 305 const v8_inspector::StringView& message,
306 const v8_inspector::StringView& url, 306 const v8_inspector::StringView& url,
307 unsigned lineNumber, 307 unsigned lineNumber,
308 unsigned columnNumber, 308 unsigned columnNumber,
309 v8_inspector::V8StackTrace* stackTrace) { 309 v8_inspector::V8StackTrace* stackTrace) {
310 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); 310 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
311 if (!frame) 311 if (!frame)
312 return; 312 return;
313 if (type == v8_inspector::V8ConsoleAPIType::kClear && frame->host())
314 frame->host()->consoleMessageStorage().clear();
315 // TODO(dgozman): we can save a copy of message and url here by making 313 // TODO(dgozman): we can save a copy of message and url here by making
316 // FrameConsole work with StringView. 314 // FrameConsole work with StringView.
317 std::unique_ptr<SourceLocation> location = 315 std::unique_ptr<SourceLocation> location =
318 SourceLocation::create(toCoreString(url), lineNumber, columnNumber, 316 SourceLocation::create(toCoreString(url), lineNumber, columnNumber,
319 stackTrace ? stackTrace->clone() : nullptr, 0); 317 stackTrace ? stackTrace->clone() : nullptr, 0);
320 frame->console().reportMessageToClient(ConsoleAPIMessageSource, 318 frame->console().reportMessageToClient(ConsoleAPIMessageSource,
321 consoleAPITypeToMessageLevel(type), 319 v8MessageLevelToMessageLevel(level),
322 toCoreString(message), location.get()); 320 toCoreString(message), location.get());
323 } 321 }
324 322
323 void MainThreadDebugger::consoleClear(int contextGroupId) {
324 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
325 if (!frame)
326 return;
327 if (frame->host())
328 frame->host()->consoleMessageStorage().clear();
329 }
330
325 v8::MaybeLocal<v8::Value> MainThreadDebugger::memoryInfo( 331 v8::MaybeLocal<v8::Value> MainThreadDebugger::memoryInfo(
326 v8::Isolate* isolate, 332 v8::Isolate* isolate,
327 v8::Local<v8::Context> context) { 333 v8::Local<v8::Context> context) {
328 ExecutionContext* executionContext = toExecutionContext(context); 334 ExecutionContext* executionContext = toExecutionContext(context);
329 DCHECK(executionContext); 335 DCHECK(executionContext);
330 ASSERT(executionContext->isDocument()); 336 ASSERT(executionContext->isDocument());
331 return ToV8(MemoryInfo::create(), context->Global(), isolate); 337 return ToV8(MemoryInfo::create(), context->Global(), isolate);
332 } 338 }
333 339
334 void MainThreadDebugger::installAdditionalCommandLineAPI( 340 void MainThreadDebugger::installAdditionalCommandLineAPI(
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 context, nodes, index++, 460 context, nodes, index++,
455 ToV8(node, info.Holder(), info.GetIsolate())) 461 ToV8(node, info.Holder(), info.GetIsolate()))
456 .FromMaybe(false)) 462 .FromMaybe(false))
457 return; 463 return;
458 } 464 }
459 info.GetReturnValue().Set(nodes); 465 info.GetReturnValue().Set(nodes);
460 } 466 }
461 } 467 }
462 468
463 } // namespace blink 469 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698