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

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

Issue 17648006: Rename WorkerContext to WorkerGlobalScope (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 6 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) 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 29 matching lines...) Expand all
40 #include "core/inspector/InspectorFrontendChannel.h" 40 #include "core/inspector/InspectorFrontendChannel.h"
41 #include "core/inspector/InspectorHeapProfilerAgent.h" 41 #include "core/inspector/InspectorHeapProfilerAgent.h"
42 #include "core/inspector/InspectorProfilerAgent.h" 42 #include "core/inspector/InspectorProfilerAgent.h"
43 #include "core/inspector/InspectorState.h" 43 #include "core/inspector/InspectorState.h"
44 #include "core/inspector/InspectorStateClient.h" 44 #include "core/inspector/InspectorStateClient.h"
45 #include "core/inspector/InspectorTimelineAgent.h" 45 #include "core/inspector/InspectorTimelineAgent.h"
46 #include "core/inspector/InstrumentingAgents.h" 46 #include "core/inspector/InstrumentingAgents.h"
47 #include "core/inspector/WorkerConsoleAgent.h" 47 #include "core/inspector/WorkerConsoleAgent.h"
48 #include "core/inspector/WorkerDebuggerAgent.h" 48 #include "core/inspector/WorkerDebuggerAgent.h"
49 #include "core/inspector/WorkerRuntimeAgent.h" 49 #include "core/inspector/WorkerRuntimeAgent.h"
50 #include "core/workers/WorkerContext.h" 50 #include "core/workers/WorkerGlobalScope.h"
51 #include "core/workers/WorkerReportingProxy.h" 51 #include "core/workers/WorkerReportingProxy.h"
52 #include "core/workers/WorkerThread.h" 52 #include "core/workers/WorkerThread.h"
53 #include <wtf/PassOwnPtr.h> 53 #include <wtf/PassOwnPtr.h>
54 54
55 namespace WebCore { 55 namespace WebCore {
56 56
57 namespace { 57 namespace {
58 58
59 class PageInspectorProxy : public InspectorFrontendChannel { 59 class PageInspectorProxy : public InspectorFrontendChannel {
60 WTF_MAKE_FAST_ALLOCATED; 60 WTF_MAKE_FAST_ALLOCATED;
61 public: 61 public:
62 explicit PageInspectorProxy(WorkerContext* workerContext) : m_workerContext( workerContext) { } 62 explicit PageInspectorProxy(WorkerGlobalScope* workerGlobalScope) : m_worker GlobalScope(workerGlobalScope) { }
63 virtual ~PageInspectorProxy() { } 63 virtual ~PageInspectorProxy() { }
64 private: 64 private:
65 virtual bool sendMessageToFrontend(const String& message) 65 virtual bool sendMessageToFrontend(const String& message)
66 { 66 {
67 m_workerContext->thread()->workerReportingProxy().postMessageToPageInspe ctor(message); 67 m_workerGlobalScope->thread()->workerReportingProxy().postMessageToPageI nspector(message);
68 return true; 68 return true;
69 } 69 }
70 WorkerContext* m_workerContext; 70 WorkerGlobalScope* m_workerGlobalScope;
71 }; 71 };
72 72
73 class WorkerStateClient : public InspectorStateClient { 73 class WorkerStateClient : public InspectorStateClient {
74 WTF_MAKE_FAST_ALLOCATED; 74 WTF_MAKE_FAST_ALLOCATED;
75 public: 75 public:
76 WorkerStateClient(WorkerContext* context) : m_workerContext(context) { } 76 WorkerStateClient(WorkerGlobalScope* context) : m_workerGlobalScope(context) { }
77 virtual ~WorkerStateClient() { } 77 virtual ~WorkerStateClient() { }
78 78
79 private: 79 private:
80 virtual void updateInspectorStateCookie(const String& cookie) 80 virtual void updateInspectorStateCookie(const String& cookie)
81 { 81 {
82 m_workerContext->thread()->workerReportingProxy().updateInspectorStateCo okie(cookie); 82 m_workerGlobalScope->thread()->workerReportingProxy().updateInspectorSta teCookie(cookie);
83 } 83 }
84 84
85 WorkerContext* m_workerContext; 85 WorkerGlobalScope* m_workerGlobalScope;
86 }; 86 };
87 87
88 } 88 }
89 89
90 WorkerInspectorController::WorkerInspectorController(WorkerContext* workerContex t) 90 WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGl obalScope)
91 : m_workerContext(workerContext) 91 : m_workerGlobalScope(workerGlobalScope)
92 , m_stateClient(adoptPtr(new WorkerStateClient(workerContext))) 92 , m_stateClient(adoptPtr(new WorkerStateClient(workerGlobalScope)))
93 , m_state(adoptPtr(new InspectorCompositeState(m_stateClient.get()))) 93 , m_state(adoptPtr(new InspectorCompositeState(m_stateClient.get())))
94 , m_instrumentingAgents(InstrumentingAgents::create()) 94 , m_instrumentingAgents(InstrumentingAgents::create())
95 , m_injectedScriptManager(InjectedScriptManager::createForWorker()) 95 , m_injectedScriptManager(InjectedScriptManager::createForWorker())
96 , m_debugServer(adoptPtr(new WorkerScriptDebugServer(workerContext, WorkerDe buggerAgent::debuggerTaskMode))) 96 , m_debugServer(adoptPtr(new WorkerScriptDebugServer(workerGlobalScope, Work erDebuggerAgent::debuggerTaskMode)))
97 { 97 {
98 m_agents.append(WorkerRuntimeAgent::create(m_instrumentingAgents.get(), m_st ate.get(), m_injectedScriptManager.get(), m_debugServer.get(), workerContext)); 98 m_agents.append(WorkerRuntimeAgent::create(m_instrumentingAgents.get(), m_st ate.get(), m_injectedScriptManager.get(), m_debugServer.get(), workerGlobalScope ));
99 99
100 OwnPtr<InspectorConsoleAgent> consoleAgent = WorkerConsoleAgent::create(m_in strumentingAgents.get(), m_state.get(), m_injectedScriptManager.get()); 100 OwnPtr<InspectorConsoleAgent> consoleAgent = WorkerConsoleAgent::create(m_in strumentingAgents.get(), m_state.get(), m_injectedScriptManager.get());
101 m_agents.append(WorkerDebuggerAgent::create(m_instrumentingAgents.get(), m_s tate.get(), m_debugServer.get(), workerContext, m_injectedScriptManager.get())); 101 m_agents.append(WorkerDebuggerAgent::create(m_instrumentingAgents.get(), m_s tate.get(), m_debugServer.get(), workerGlobalScope, m_injectedScriptManager.get( )));
102 102
103 m_agents.append(InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent.get(), m_state.get(), m_injectedScriptManager.get())); 103 m_agents.append(InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent.get(), m_state.get(), m_injectedScriptManager.get()));
104 m_agents.append(InspectorHeapProfilerAgent::create(m_instrumentingAgents.get (), m_state.get(), m_injectedScriptManager.get())); 104 m_agents.append(InspectorHeapProfilerAgent::create(m_instrumentingAgents.get (), m_state.get(), m_injectedScriptManager.get()));
105 m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), 0, 0, 0, m_state.get(), InspectorTimelineAgent::WorkerInspector, 0)); 105 m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), 0, 0, 0, m_state.get(), InspectorTimelineAgent::WorkerInspector, 0));
106 m_agents.append(consoleAgent.release()); 106 m_agents.append(consoleAgent.release());
107 107
108 m_injectedScriptManager->injectedScriptHost()->init(m_instrumentingAgents.ge t(), m_debugServer.get()); 108 m_injectedScriptManager->injectedScriptHost()->init(m_instrumentingAgents.ge t(), m_debugServer.get());
109 } 109 }
110 110
111 WorkerInspectorController::~WorkerInspectorController() 111 WorkerInspectorController::~WorkerInspectorController()
112 { 112 {
113 m_instrumentingAgents->reset(); 113 m_instrumentingAgents->reset();
114 disconnectFrontend(); 114 disconnectFrontend();
115 } 115 }
116 116
117 void WorkerInspectorController::connectFrontend() 117 void WorkerInspectorController::connectFrontend()
118 { 118 {
119 ASSERT(!m_frontend); 119 ASSERT(!m_frontend);
120 m_state->unmute(); 120 m_state->unmute();
121 m_frontendChannel = adoptPtr(new PageInspectorProxy(m_workerContext)); 121 m_frontendChannel = adoptPtr(new PageInspectorProxy(m_workerGlobalScope));
122 m_frontend = adoptPtr(new InspectorFrontend(m_frontendChannel.get())); 122 m_frontend = adoptPtr(new InspectorFrontend(m_frontendChannel.get()));
123 m_backendDispatcher = InspectorBackendDispatcher::create(m_frontendChannel.g et()); 123 m_backendDispatcher = InspectorBackendDispatcher::create(m_frontendChannel.g et());
124 m_agents.registerInDispatcher(m_backendDispatcher.get()); 124 m_agents.registerInDispatcher(m_backendDispatcher.get());
125 m_agents.setFrontend(m_frontend.get()); 125 m_agents.setFrontend(m_frontend.get());
126 } 126 }
127 127
128 void WorkerInspectorController::disconnectFrontend() 128 void WorkerInspectorController::disconnectFrontend()
129 { 129 {
130 if (!m_frontend) 130 if (!m_frontend)
131 return; 131 return;
(...skipping 24 matching lines...) Expand all
156 156
157 void WorkerInspectorController::resume() 157 void WorkerInspectorController::resume()
158 { 158 {
159 if (WorkerRuntimeAgent* runtimeAgent = m_instrumentingAgents->workerRuntimeA gent()) { 159 if (WorkerRuntimeAgent* runtimeAgent = m_instrumentingAgents->workerRuntimeA gent()) {
160 ErrorString unused; 160 ErrorString unused;
161 runtimeAgent->run(&unused); 161 runtimeAgent->run(&unused);
162 } 162 }
163 } 163 }
164 164
165 } 165 }
OLDNEW
« no previous file with comments | « Source/core/inspector/WorkerInspectorController.h ('k') | Source/core/inspector/WorkerRuntimeAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698