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

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

Issue 2800213002: Avoid duplicate functions/code in core/inspector.
Patch Set: Manual inlined urlWithoutFragment Created 3 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
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "core/xml/XPathResult.h" 66 #include "core/xml/XPathResult.h"
67 #include "platform/bindings/DOMWrapperWorld.h" 67 #include "platform/bindings/DOMWrapperWorld.h"
68 #include "platform/wtf/PtrUtil.h" 68 #include "platform/wtf/PtrUtil.h"
69 #include "platform/wtf/ThreadingPrimitives.h" 69 #include "platform/wtf/ThreadingPrimitives.h"
70 #include "platform/wtf/text/StringBuilder.h" 70 #include "platform/wtf/text/StringBuilder.h"
71 71
72 namespace blink { 72 namespace blink {
73 73
74 namespace { 74 namespace {
75 75
76 int FrameId(LocalFrame& frame) {
77 return WeakIdentifierMap<LocalFrame>::Identifier(&frame);
78 }
79
80 Mutex& CreationMutex() { 76 Mutex& CreationMutex() {
81 DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, ()); 77 DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, ());
82 return mutex; 78 return mutex;
83 } 79 }
84 80
85 LocalFrame* ToFrame(ExecutionContext* context) { 81 LocalFrame* ToFrame(ExecutionContext* context) {
86 if (!context) 82 if (!context)
87 return nullptr; 83 return nullptr;
88 if (context->IsDocument()) 84 if (context->IsDocument())
89 return ToDocument(context)->GetFrame(); 85 return ToDocument(context)->GetFrame();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 script_state->GetContext(), ToV8InspectorStringView(default_message), 203 script_state->GetContext(), ToV8InspectorStringView(default_message),
208 exception, ToV8InspectorStringView(message), 204 exception, ToV8InspectorStringView(message),
209 ToV8InspectorStringView(url), location->LineNumber(), 205 ToV8InspectorStringView(url), location->LineNumber(),
210 location->ColumnNumber(), location->TakeStackTrace(), 206 location->ColumnNumber(), location->TakeStackTrace(),
211 location->ScriptId()); 207 location->ScriptId());
212 } 208 }
213 } 209 }
214 210
215 int MainThreadDebugger::ContextGroupId(LocalFrame* frame) { 211 int MainThreadDebugger::ContextGroupId(LocalFrame* frame) {
216 LocalFrame& local_frame_root = frame->LocalFrameRoot(); 212 LocalFrame& local_frame_root = frame->LocalFrameRoot();
217 return FrameId(local_frame_root); 213 return WeakIdentifierMap<LocalFrame>::Identifier(&local_frame_root);
218 } 214 }
219 215
220 MainThreadDebugger* MainThreadDebugger::Instance() { 216 MainThreadDebugger* MainThreadDebugger::Instance() {
221 DCHECK(IsMainThread()); 217 DCHECK(IsMainThread());
222 ThreadDebugger* debugger = 218 ThreadDebugger* debugger =
223 ThreadDebugger::From(V8PerIsolateData::MainThreadIsolate()); 219 ThreadDebugger::From(V8PerIsolateData::MainThreadIsolate());
224 DCHECK(debugger && !debugger->IsWorker()); 220 DCHECK(debugger && !debugger->IsWorker());
225 return static_cast<MainThreadDebugger*>(debugger); 221 return static_cast<MainThreadDebugger*>(debugger);
226 } 222 }
227 223
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 context, nodes, index++, 459 context, nodes, index++,
464 ToV8(node, info.Holder(), info.GetIsolate())) 460 ToV8(node, info.Holder(), info.GetIsolate()))
465 .FromMaybe(false)) 461 .FromMaybe(false))
466 return; 462 return;
467 } 463 }
468 info.GetReturnValue().Set(nodes); 464 info.GetReturnValue().Set(nodes);
469 } 465 }
470 } 466 }
471 467
472 } // namespace blink 468 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698