| OLD | NEW |
| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 public: | 56 public: |
| 57 explicit WorkerFrontendChannel(InspectorFrontend* frontend, WorkerContextPro
xy* proxy) | 57 explicit WorkerFrontendChannel(InspectorFrontend* frontend, WorkerContextPro
xy* proxy) |
| 58 : m_frontend(frontend) | 58 : m_frontend(frontend) |
| 59 , m_proxy(proxy) | 59 , m_proxy(proxy) |
| 60 , m_id(s_nextId++) | 60 , m_id(s_nextId++) |
| 61 , m_connected(false) | 61 , m_connected(false) |
| 62 { | 62 { |
| 63 } | 63 } |
| 64 virtual ~WorkerFrontendChannel() | 64 virtual ~WorkerFrontendChannel() |
| 65 { | 65 { |
| 66 disconnectFromWorkerContext(); |
| 66 } | 67 } |
| 67 | 68 |
| 68 int id() const { return m_id; } | 69 int id() const { return m_id; } |
| 69 WorkerContextProxy* proxy() const { return m_proxy; } | 70 WorkerContextProxy* proxy() const { return m_proxy; } |
| 70 | 71 |
| 71 void connectToWorkerContext() | 72 void connectToWorkerContext() |
| 72 { | 73 { |
| 73 if (m_connected) | 74 if (m_connected) |
| 74 return; | 75 return; |
| 75 m_connected = true; | 76 m_connected = true; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 130 } |
| 130 | 131 |
| 131 void InspectorWorkerAgent::restore() | 132 void InspectorWorkerAgent::restore() |
| 132 { | 133 { |
| 133 if (m_state->getBoolean(WorkerAgentState::workerInspectionEnabled)) | 134 if (m_state->getBoolean(WorkerAgentState::workerInspectionEnabled)) |
| 134 createWorkerFrontendChannelsForExistingWorkers(); | 135 createWorkerFrontendChannelsForExistingWorkers(); |
| 135 } | 136 } |
| 136 | 137 |
| 137 void InspectorWorkerAgent::clearFrontend() | 138 void InspectorWorkerAgent::clearFrontend() |
| 138 { | 139 { |
| 140 m_state->setBoolean(WorkerAgentState::autoconnectToWorkers, false); |
| 141 disable(0); |
| 139 m_inspectorFrontend = 0; | 142 m_inspectorFrontend = 0; |
| 140 m_state->setBoolean(WorkerAgentState::autoconnectToWorkers, false); | |
| 141 destroyWorkerFrontendChannels(); | |
| 142 } | 143 } |
| 143 | 144 |
| 144 void InspectorWorkerAgent::enable(ErrorString*) | 145 void InspectorWorkerAgent::enable(ErrorString*) |
| 145 { | 146 { |
| 146 m_state->setBoolean(WorkerAgentState::workerInspectionEnabled, true); | 147 m_state->setBoolean(WorkerAgentState::workerInspectionEnabled, true); |
| 147 if (!m_inspectorFrontend) | 148 if (!m_inspectorFrontend) |
| 148 return; | 149 return; |
| 149 createWorkerFrontendChannelsForExistingWorkers(); | 150 createWorkerFrontendChannelsForExistingWorkers(); |
| 150 } | 151 } |
| 151 | 152 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 ASSERT(m_inspectorFrontend); | 238 ASSERT(m_inspectorFrontend); |
| 238 bool autoconnectToWorkers = m_state->getBoolean(WorkerAgentState::autoconnec
tToWorkers); | 239 bool autoconnectToWorkers = m_state->getBoolean(WorkerAgentState::autoconnec
tToWorkers); |
| 239 if (autoconnectToWorkers) | 240 if (autoconnectToWorkers) |
| 240 channel->connectToWorkerContext(); | 241 channel->connectToWorkerContext(); |
| 241 m_inspectorFrontend->worker()->workerCreated(channel->id(), url, autoconnect
ToWorkers); | 242 m_inspectorFrontend->worker()->workerCreated(channel->id(), url, autoconnect
ToWorkers); |
| 242 } | 243 } |
| 243 | 244 |
| 244 } // namespace WebCore | 245 } // namespace WebCore |
| 245 | 246 |
| 246 #endif // ENABLE(WORKERS) && ENABLE(INSPECTOR) | 247 #endif // ENABLE(WORKERS) && ENABLE(INSPECTOR) |
| OLD | NEW |