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

Side by Side Diff: Source/core/inspector/InspectorRuntimeAgent.cpp

Issue 1311353007: Devtools: Save custom formatter's state in the runtimeAgent (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 27 matching lines...) Expand all
38 #include "core/inspector/RemoteObjectId.h" 38 #include "core/inspector/RemoteObjectId.h"
39 #include "core/inspector/v8/V8Debugger.h" 39 #include "core/inspector/v8/V8Debugger.h"
40 #include "platform/JSONValues.h" 40 #include "platform/JSONValues.h"
41 41
42 using blink::TypeBuilder::Runtime::ExecutionContextDescription; 42 using blink::TypeBuilder::Runtime::ExecutionContextDescription;
43 43
44 namespace blink { 44 namespace blink {
45 45
46 namespace InspectorRuntimeAgentState { 46 namespace InspectorRuntimeAgentState {
47 static const char runtimeEnabled[] = "runtimeEnabled"; 47 static const char runtimeEnabled[] = "runtimeEnabled";
48 static const char customObjectFormatterEnabled[] = "customObjectFormatterEnabled ";
48 }; 49 };
49 50
50 class InspectorRuntimeAgent::InjectedScriptCallScope { 51 class InspectorRuntimeAgent::InjectedScriptCallScope {
51 STACK_ALLOCATED(); 52 STACK_ALLOCATED();
52 public: 53 public:
53 InjectedScriptCallScope(InspectorRuntimeAgent* agent, bool doNotPauseOnExcep tionsAndMuteConsole) 54 InjectedScriptCallScope(InspectorRuntimeAgent* agent, bool doNotPauseOnExcep tionsAndMuteConsole)
54 : m_agent(agent) 55 : m_agent(agent)
55 , m_doNotPauseOnExceptionsAndMuteConsole(doNotPauseOnExceptionsAndMuteCo nsole) 56 , m_doNotPauseOnExceptionsAndMuteConsole(doNotPauseOnExceptionsAndMuteCo nsole)
56 , m_previousPauseOnExceptionsState(V8Debugger::DontPauseOnExceptions) 57 , m_previousPauseOnExceptionsState(V8Debugger::DontPauseOnExceptions)
57 { 58 {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 m_client->resumeStartup(); 190 m_client->resumeStartup();
190 } 191 }
191 192
192 void InspectorRuntimeAgent::isRunRequired(ErrorString*, bool* out_result) 193 void InspectorRuntimeAgent::isRunRequired(ErrorString*, bool* out_result)
193 { 194 {
194 *out_result = m_client->isRunRequired(); 195 *out_result = m_client->isRunRequired();
195 } 196 }
196 197
197 void InspectorRuntimeAgent::setCustomObjectFormatterEnabled(ErrorString*, bool e nabled) 198 void InspectorRuntimeAgent::setCustomObjectFormatterEnabled(ErrorString*, bool e nabled)
198 { 199 {
200 m_state->setBoolean(InspectorRuntimeAgentState::customObjectFormatterEnabled , enabled);
199 injectedScriptManager()->setCustomObjectFormatterEnabled(enabled); 201 injectedScriptManager()->setCustomObjectFormatterEnabled(enabled);
200 } 202 }
201 203
202 void InspectorRuntimeAgent::restore() 204 void InspectorRuntimeAgent::restore()
203 { 205 {
204 if (m_state->getBoolean(InspectorRuntimeAgentState::runtimeEnabled)) { 206 if (m_state->getBoolean(InspectorRuntimeAgentState::runtimeEnabled)) {
205 frontend()->executionContextsCleared(); 207 frontend()->executionContextsCleared();
206 String error; 208 String error;
207 enable(&error); 209 enable(&error);
210 if (m_state->getBoolean(InspectorRuntimeAgentState::customObjectFormatte rEnabled))
211 injectedScriptManager()->setCustomObjectFormatterEnabled(true);
208 } 212 }
209 } 213 }
210 214
211 void InspectorRuntimeAgent::enable(ErrorString* errorString) 215 void InspectorRuntimeAgent::enable(ErrorString* errorString)
212 { 216 {
213 if (m_enabled) 217 if (m_enabled)
214 return; 218 return;
215 219
216 m_enabled = true; 220 m_enabled = true;
217 m_state->setBoolean(InspectorRuntimeAgentState::runtimeEnabled, true); 221 m_state->setBoolean(InspectorRuntimeAgentState::runtimeEnabled, true);
(...skipping 14 matching lines...) Expand all
232 .setId(executionContextId) 236 .setId(executionContextId)
233 .setName(humanReadableName) 237 .setName(humanReadableName)
234 .setOrigin(origin) 238 .setOrigin(origin)
235 .setFrameId(frameId); 239 .setFrameId(frameId);
236 if (!type.isEmpty()) 240 if (!type.isEmpty())
237 description->setType(type); 241 description->setType(type);
238 frontend()->executionContextCreated(description.release()); 242 frontend()->executionContextCreated(description.release());
239 } 243 }
240 244
241 } // namespace blink 245 } // 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