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

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

Issue 1004113004: [DevTools] Do not instrument with InspectorInspectorAgent. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 InspectorInspectorAgent::InspectorInspectorAgent(InjectedScriptManager* injected ScriptManager) 54 InspectorInspectorAgent::InspectorInspectorAgent(InjectedScriptManager* injected ScriptManager)
55 : InspectorBaseAgent<InspectorInspectorAgent, InspectorFrontend::Inspector>( "Inspector") 55 : InspectorBaseAgent<InspectorInspectorAgent, InspectorFrontend::Inspector>( "Inspector")
56 , m_injectedScriptManager(injectedScriptManager) 56 , m_injectedScriptManager(injectedScriptManager)
57 { 57 {
58 } 58 }
59 59
60 InspectorInspectorAgent::~InspectorInspectorAgent() 60 InspectorInspectorAgent::~InspectorInspectorAgent()
61 { 61 {
62 #if !ENABLE(OILPAN)
63 m_instrumentingAgents->setInspectorInspectorAgent(nullptr);
64 #endif
65 } 62 }
66 63
67 DEFINE_TRACE(InspectorInspectorAgent) 64 DEFINE_TRACE(InspectorInspectorAgent)
68 { 65 {
69 visitor->trace(m_injectedScriptManager); 66 visitor->trace(m_injectedScriptManager);
70 InspectorBaseAgent::trace(visitor); 67 InspectorBaseAgent::trace(visitor);
71 } 68 }
72 69
73 void InspectorInspectorAgent::init()
74 {
75 m_instrumentingAgents->setInspectorInspectorAgent(this);
76 }
77
78 void InspectorInspectorAgent::enable(ErrorString*) 70 void InspectorInspectorAgent::enable(ErrorString*)
79 { 71 {
80 m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, true); 72 m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, true);
73 m_instrumentingAgents->setInspectorInspectorAgent(this);
pfeldman 2015/03/24 13:18:54 I don't see why this domain should instrument anyt
dgozman 2015/03/24 13:19:40 It is used by InjectedScriptHost.
81 74
82 for (Vector<pair<long, String>>::iterator it = m_pendingEvaluateTestCommands .begin(); frontend() && it != m_pendingEvaluateTestCommands.end(); ++it) 75 for (Vector<pair<long, String>>::iterator it = m_pendingEvaluateTestCommands .begin(); frontend() && it != m_pendingEvaluateTestCommands.end(); ++it)
83 frontend()->evaluateForTestInFrontend(static_cast<int>((*it).first), (*i t).second); 76 frontend()->evaluateForTestInFrontend(static_cast<int>((*it).first), (*i t).second);
84 m_pendingEvaluateTestCommands.clear(); 77 m_pendingEvaluateTestCommands.clear();
85 } 78 }
86 79
87 void InspectorInspectorAgent::disable(ErrorString*) 80 void InspectorInspectorAgent::disable(ErrorString*)
88 { 81 {
89 m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, false); 82 m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, false);
83 m_instrumentingAgents->setInspectorInspectorAgent(nullptr);
90 m_pendingEvaluateTestCommands.clear(); 84 m_pendingEvaluateTestCommands.clear();
91 m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects(); 85 m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects();
92 m_injectedScriptManager->discardInjectedScripts(); 86 m_injectedScriptManager->discardInjectedScripts();
93 } 87 }
94 88
95 void InspectorInspectorAgent::domContentLoadedEventFired(LocalFrame* frame) 89 void InspectorInspectorAgent::didCommitLoadForLocalFrame(LocalFrame* frame)
96 { 90 {
97 if (frame != frame->localFrameRoot()) 91 if (frame != frame->localFrameRoot())
98 return; 92 return;
99 93
100 m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects(); 94 m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects();
101 } 95 }
102 96
97 void InspectorInspectorAgent::restore()
98 {
99 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) {
100 ErrorString error;
101 enable(&error);
102 }
103 }
104
103 void InspectorInspectorAgent::evaluateForTestInFrontend(long callId, const Strin g& script) 105 void InspectorInspectorAgent::evaluateForTestInFrontend(long callId, const Strin g& script)
104 { 106 {
105 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) { 107 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) {
106 frontend()->evaluateForTestInFrontend(static_cast<int>(callId), script); 108 frontend()->evaluateForTestInFrontend(static_cast<int>(callId), script);
107 frontend()->flush(); 109 frontend()->flush();
108 } else { 110 } else {
109 m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script)) ; 111 m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script)) ;
110 } 112 }
111 } 113 }
112 114
113 void InspectorInspectorAgent::inspect(PassRefPtr<TypeBuilder::Runtime::RemoteObj ect> objectToInspect, PassRefPtr<JSONObject> hints) 115 void InspectorInspectorAgent::inspect(PassRefPtr<TypeBuilder::Runtime::RemoteObj ect> objectToInspect, PassRefPtr<JSONObject> hints)
114 { 116 {
115 if (frontend() && m_state->getBoolean(InspectorAgentState::inspectorAgentEna bled)) 117 if (frontend() && m_state->getBoolean(InspectorAgentState::inspectorAgentEna bled))
116 frontend()->inspect(objectToInspect, hints); 118 frontend()->inspect(objectToInspect, hints);
117 } 119 }
118 120
119 } // namespace blink 121 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorInspectorAgent.h ('k') | Source/core/inspector/InspectorInstrumentation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698