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

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

Issue 898593002: DevTools: use per-LocalFrame instrumenting agents instead of per-Page ones. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed assertion Created 5 years, 10 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "core/page/Page.h" 45 #include "core/page/Page.h"
46 #include "platform/weborigin/SecurityOrigin.h" 46 #include "platform/weborigin/SecurityOrigin.h"
47 #include "wtf/text/StringBuilder.h" 47 #include "wtf/text/StringBuilder.h"
48 48
49 namespace blink { 49 namespace blink {
50 50
51 namespace InspectorAgentState { 51 namespace InspectorAgentState {
52 static const char inspectorAgentEnabled[] = "inspectorAgentEnabled"; 52 static const char inspectorAgentEnabled[] = "inspectorAgentEnabled";
53 } 53 }
54 54
55 InspectorInspectorAgent::InspectorInspectorAgent(Page* page, InjectedScriptManag er* injectedScriptManager) 55 InspectorInspectorAgent::InspectorInspectorAgent(InspectorController* inspectorC ontroller, InjectedScriptManager* injectedScriptManager)
56 : InspectorBaseAgent<InspectorInspectorAgent>("Inspector") 56 : InspectorBaseAgent<InspectorInspectorAgent>("Inspector")
57 , m_inspectedPage(page) 57 , m_inspectorController(inspectorController)
58 , m_frontend(nullptr) 58 , m_frontend(nullptr)
59 , m_injectedScriptManager(injectedScriptManager) 59 , m_injectedScriptManager(injectedScriptManager)
60 { 60 {
61 ASSERT_ARG(page, page); 61 ASSERT_ARG(inspectorController, inspectorController);
62 } 62 }
63 63
64 InspectorInspectorAgent::~InspectorInspectorAgent() 64 InspectorInspectorAgent::~InspectorInspectorAgent()
65 { 65 {
66 #if !ENABLE(OILPAN) 66 #if !ENABLE(OILPAN)
67 m_instrumentingAgents->setInspectorInspectorAgent(nullptr); 67 m_instrumentingAgents->setInspectorInspectorAgent(nullptr);
68 #endif 68 #endif
69 } 69 }
70 70
71 void InspectorInspectorAgent::trace(Visitor* visitor) 71 void InspectorInspectorAgent::trace(Visitor* visitor)
72 { 72 {
73 visitor->trace(m_inspectedPage); 73 visitor->trace(m_inspectorController);
74 visitor->trace(m_injectedScriptManager); 74 visitor->trace(m_injectedScriptManager);
75 InspectorBaseAgent::trace(visitor); 75 InspectorBaseAgent::trace(visitor);
76 } 76 }
77 77
78 void InspectorInspectorAgent::didClearDocumentOfWindowObject(LocalFrame* frame) 78 void InspectorInspectorAgent::didClearDocumentOfWindowObject(LocalFrame* frame)
79 { 79 {
80 if (m_injectedScriptForOrigin.isEmpty()) 80 if (m_injectedScriptForOrigin.isEmpty())
81 return; 81 return;
82 82
83 String origin = frame->document()->securityOrigin()->toRawString(); 83 String origin = frame->document()->securityOrigin()->toRawString();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 m_pendingEvaluateTestCommands.clear(); 124 m_pendingEvaluateTestCommands.clear();
125 } 125 }
126 126
127 void InspectorInspectorAgent::disable(ErrorString*) 127 void InspectorInspectorAgent::disable(ErrorString*)
128 { 128 {
129 m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, false); 129 m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, false);
130 } 130 }
131 131
132 void InspectorInspectorAgent::reset(ErrorString*) 132 void InspectorInspectorAgent::reset(ErrorString*)
133 { 133 {
134 m_inspectedPage->inspectorController().reconnectFrontend(); 134 m_inspectorController->reconnectFrontend();
135 } 135 }
136 136
137 void InspectorInspectorAgent::domContentLoadedEventFired(LocalFrame* frame) 137 void InspectorInspectorAgent::domContentLoadedEventFired(LocalFrame* frame)
138 { 138 {
139 if (frame->page()->mainFrame() != frame) 139 if (frame != frame->localFrameRoot())
140 return; 140 return;
141 141
142 m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects(); 142 m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects();
143 } 143 }
144 144
145 void InspectorInspectorAgent::evaluateForTestInFrontend(long callId, const Strin g& script) 145 void InspectorInspectorAgent::evaluateForTestInFrontend(long callId, const Strin g& script)
146 { 146 {
147 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) { 147 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) {
148 m_frontend->evaluateForTestInFrontend(static_cast<int>(callId), script); 148 m_frontend->evaluateForTestInFrontend(static_cast<int>(callId), script);
149 m_frontend->flush(); 149 m_frontend->flush();
(...skipping 13 matching lines...) Expand all
163 m_frontend->inspect(objectToInspect, hints); 163 m_frontend->inspect(objectToInspect, hints);
164 m_pendingInspectData.first = nullptr; 164 m_pendingInspectData.first = nullptr;
165 m_pendingInspectData.second = nullptr; 165 m_pendingInspectData.second = nullptr;
166 return; 166 return;
167 } 167 }
168 m_pendingInspectData.first = objectToInspect; 168 m_pendingInspectData.first = objectToInspect;
169 m_pendingInspectData.second = hints; 169 m_pendingInspectData.second = hints;
170 } 170 }
171 171
172 } // namespace blink 172 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorInspectorAgent.h ('k') | Source/core/inspector/InspectorInstrumentation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698