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

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

Issue 2194683003: [DevTools] Cleanup v8_inspector console API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile 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 /* 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); 232 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
233 frame->settings()->setForceMainWorldInitialization(true); 233 frame->settings()->setForceMainWorldInitialization(true);
234 } 234 }
235 235
236 void MainThreadDebugger::endEnsureAllContextsInGroup(int contextGroupId) 236 void MainThreadDebugger::endEnsureAllContextsInGroup(int contextGroupId)
237 { 237 {
238 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); 238 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
239 frame->settings()->setForceMainWorldInitialization(false); 239 frame->settings()->setForceMainWorldInitialization(false);
240 } 240 }
241 241
242 void MainThreadDebugger::consoleAPIMessage(int contextGroupId, MessageLevel leve l, const String16& message, const String16& url, unsigned lineNumber, unsigned c olumnNumber, V8StackTrace* stackTrace) 242 void MainThreadDebugger::consoleAPIMessage(int contextGroupId, V8ConsoleAPIType type, const String16& message, const String16& url, unsigned lineNumber, unsigne d columnNumber, V8StackTrace* stackTrace)
243 { 243 {
244 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); 244 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
245 if (!frame) 245 if (!frame)
246 return; 246 return;
247 if (type == V8ConsoleAPIType::kClear && frame->host())
248 frame->host()->consoleMessageStorage().clear();
247 // TODO(dgozman): maybe not wrap with ConsoleMessage. 249 // TODO(dgozman): maybe not wrap with ConsoleMessage.
248 ConsoleMessage* consoleMessage = ConsoleMessage::create(ConsoleAPIMessageSou rce, level, message, SourceLocation::create(url, lineNumber, columnNumber, stack Trace ? stackTrace->clone() : nullptr, 0)); 250 ConsoleMessage* consoleMessage = ConsoleMessage::create(ConsoleAPIMessageSou rce, consoleAPITypeToMessageLevel(type), message, SourceLocation::create(url, li neNumber, columnNumber, stackTrace ? stackTrace->clone() : nullptr, 0));
249 frame->console().reportMessageToClient(consoleMessage); 251 frame->console().reportMessageToClient(consoleMessage);
250 } 252 }
251 253
252 v8::MaybeLocal<v8::Value> MainThreadDebugger::memoryInfo(v8::Isolate* isolate, v 8::Local<v8::Context> context) 254 v8::MaybeLocal<v8::Value> MainThreadDebugger::memoryInfo(v8::Isolate* isolate, v 8::Local<v8::Context> context)
253 { 255 {
254 ExecutionContext* executionContext = toExecutionContext(context); 256 ExecutionContext* executionContext = toExecutionContext(context);
255 ASSERT_UNUSED(executionContext, executionContext); 257 ASSERT_UNUSED(executionContext, executionContext);
256 ASSERT(executionContext->isDocument()); 258 ASSERT(executionContext->isDocument());
257 return toV8(MemoryInfo::create(), context->Global(), isolate); 259 return toV8(MemoryInfo::create(), context->Global(), isolate);
258 } 260 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 return; 356 return;
355 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get Isolate())).FromMaybe(false)) 357 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get Isolate())).FromMaybe(false))
356 return; 358 return;
357 } 359 }
358 info.GetReturnValue().Set(nodes); 360 info.GetReturnValue().Set(nodes);
359 } 361 }
360 exceptionState.throwIfNeeded(); 362 exceptionState.throwIfNeeded();
361 } 363 }
362 364
363 } // namespace blink 365 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698