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

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

Issue 2746053003: [DevTools] replaced slow ::serialize with StringBuilder (Closed)
Patch Set: fixed Created 3 years, 9 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 | « no previous file | 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "core/frame/LocalDOMWindow.h" 52 #include "core/frame/LocalDOMWindow.h"
53 #include "core/frame/LocalFrame.h" 53 #include "core/frame/LocalFrame.h"
54 #include "core/frame/Settings.h" 54 #include "core/frame/Settings.h"
55 #include "core/frame/UseCounter.h" 55 #include "core/frame/UseCounter.h"
56 #include "core/inspector/ConsoleMessage.h" 56 #include "core/inspector/ConsoleMessage.h"
57 #include "core/inspector/ConsoleMessageStorage.h" 57 #include "core/inspector/ConsoleMessageStorage.h"
58 #include "core/inspector/IdentifiersFactory.h" 58 #include "core/inspector/IdentifiersFactory.h"
59 #include "core/inspector/InspectedFrames.h" 59 #include "core/inspector/InspectedFrames.h"
60 #include "core/inspector/InspectorTaskRunner.h" 60 #include "core/inspector/InspectorTaskRunner.h"
61 #include "core/inspector/V8InspectorString.h" 61 #include "core/inspector/V8InspectorString.h"
62 #include "core/inspector/protocol/Protocol.h"
63 #include "core/page/Page.h" 62 #include "core/page/Page.h"
64 #include "core/timing/MemoryInfo.h" 63 #include "core/timing/MemoryInfo.h"
65 #include "core/workers/MainThreadWorkletGlobalScope.h" 64 #include "core/workers/MainThreadWorkletGlobalScope.h"
66 #include "core/xml/XPathEvaluator.h" 65 #include "core/xml/XPathEvaluator.h"
67 #include "core/xml/XPathResult.h" 66 #include "core/xml/XPathResult.h"
68 #include "platform/UserGestureIndicator.h" 67 #include "platform/UserGestureIndicator.h"
69 #include "wtf/PtrUtil.h" 68 #include "wtf/PtrUtil.h"
70 #include "wtf/ThreadingPrimitives.h" 69 #include "wtf/ThreadingPrimitives.h"
70 #include "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) { 76 int frameId(LocalFrame* frame) {
77 ASSERT(frame); 77 ASSERT(frame);
78 return WeakIdentifierMap<LocalFrame>::identifier(frame); 78 return WeakIdentifierMap<LocalFrame>::identifier(frame);
79 } 79 }
80 80
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (frame->localFrameRoot() == frame) 137 if (frame->localFrameRoot() == frame)
138 v8Inspector()->resetContextGroup(contextGroupId(frame)); 138 v8Inspector()->resetContextGroup(contextGroupId(frame));
139 } 139 }
140 140
141 void MainThreadDebugger::contextCreated(ScriptState* scriptState, 141 void MainThreadDebugger::contextCreated(ScriptState* scriptState,
142 LocalFrame* frame, 142 LocalFrame* frame,
143 SecurityOrigin* origin) { 143 SecurityOrigin* origin) {
144 ASSERT(isMainThread()); 144 ASSERT(isMainThread());
145 v8::HandleScope handles(scriptState->isolate()); 145 v8::HandleScope handles(scriptState->isolate());
146 DOMWrapperWorld& world = scriptState->world(); 146 DOMWrapperWorld& world = scriptState->world();
147 std::unique_ptr<protocol::DictionaryValue> auxDataValue = 147 StringBuilder auxDataBuilder;
148 protocol::DictionaryValue::create(); 148 auxDataBuilder.append("{\"isDefault\":");
149 auxDataValue->setBoolean("isDefault", world.isMainWorld()); 149 auxDataBuilder.append(world.isMainWorld() ? "true" : "false");
150 auxDataValue->setString("frameId", IdentifiersFactory::frameId(frame)); 150 auxDataBuilder.append(",\"frameId\":\"");
151 String auxData = auxDataValue->serialize(); 151 auxDataBuilder.append(IdentifiersFactory::frameId(frame));
152 auxDataBuilder.append("\"}");
153 String auxData = auxDataBuilder.toString();
152 String humanReadableName = world.isIsolatedWorld() 154 String humanReadableName = world.isIsolatedWorld()
153 ? world.isolatedWorldHumanReadableName() 155 ? world.isolatedWorldHumanReadableName()
154 : String(); 156 : String();
155 String originString = origin ? origin->toRawString() : String(); 157 String originString = origin ? origin->toRawString() : String();
156 v8_inspector::V8ContextInfo contextInfo( 158 v8_inspector::V8ContextInfo contextInfo(
157 scriptState->context(), contextGroupId(frame), 159 scriptState->context(), contextGroupId(frame),
158 toV8InspectorStringView(humanReadableName)); 160 toV8InspectorStringView(humanReadableName));
159 contextInfo.origin = toV8InspectorStringView(originString); 161 contextInfo.origin = toV8InspectorStringView(originString);
160 contextInfo.auxData = toV8InspectorStringView(auxData); 162 contextInfo.auxData = toV8InspectorStringView(auxData);
161 contextInfo.hasMemoryOnConsole = 163 contextInfo.hasMemoryOnConsole =
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 context, nodes, index++, 464 context, nodes, index++,
463 ToV8(node, info.Holder(), info.GetIsolate())) 465 ToV8(node, info.Holder(), info.GetIsolate()))
464 .FromMaybe(false)) 466 .FromMaybe(false))
465 return; 467 return;
466 } 468 }
467 info.GetReturnValue().Set(nodes); 469 info.GetReturnValue().Set(nodes);
468 } 470 }
469 } 471 }
470 472
471 } // namespace blink 473 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698