| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "wtf/RefPtr.h" | 43 #include "wtf/RefPtr.h" |
| 44 #include "wtf/text/WTFString.h" | 44 #include "wtf/text/WTFString.h" |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 namespace WorkerAgentState { | 48 namespace WorkerAgentState { |
| 49 static const char workerInspectionEnabled[] = "workerInspectionEnabled"; | 49 static const char workerInspectionEnabled[] = "workerInspectionEnabled"; |
| 50 static const char autoconnectToWorkers[] = "autoconnectToWorkers"; | 50 static const char autoconnectToWorkers[] = "autoconnectToWorkers"; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 class InspectorWorkerAgent::WorkerFrontendChannel FINAL : public WorkerInspector
Proxy::PageInspector { | 53 class InspectorWorkerAgent::WorkerFrontendChannel final : public WorkerInspector
Proxy::PageInspector { |
| 54 WTF_MAKE_FAST_ALLOCATED; | 54 WTF_MAKE_FAST_ALLOCATED; |
| 55 public: | 55 public: |
| 56 explicit WorkerFrontendChannel(InspectorFrontend::Worker* frontend, WorkerIn
spectorProxy* proxy) | 56 explicit WorkerFrontendChannel(InspectorFrontend::Worker* frontend, WorkerIn
spectorProxy* proxy) |
| 57 : m_frontend(frontend) | 57 : m_frontend(frontend) |
| 58 , m_proxy(proxy) | 58 , m_proxy(proxy) |
| 59 , m_id(s_nextId++) | 59 , m_id(s_nextId++) |
| 60 , m_connected(false) | 60 , m_connected(false) |
| 61 { | 61 { |
| 62 ASSERT(!proxy->pageInspector()); | 62 ASSERT(!proxy->pageInspector()); |
| 63 } | 63 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 80 void disconnectFromWorker() | 80 void disconnectFromWorker() |
| 81 { | 81 { |
| 82 if (!m_connected) | 82 if (!m_connected) |
| 83 return; | 83 return; |
| 84 m_connected = false; | 84 m_connected = false; |
| 85 m_proxy->disconnectFromInspector(); | 85 m_proxy->disconnectFromInspector(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 // WorkerInspectorProxy::PageInspector implementation | 89 // WorkerInspectorProxy::PageInspector implementation |
| 90 virtual void dispatchMessageFromWorker(const String& message) OVERRIDE | 90 virtual void dispatchMessageFromWorker(const String& message) override |
| 91 { | 91 { |
| 92 RefPtr<JSONValue> value = parseJSON(message); | 92 RefPtr<JSONValue> value = parseJSON(message); |
| 93 if (!value) | 93 if (!value) |
| 94 return; | 94 return; |
| 95 RefPtr<JSONObject> messageObject = value->asObject(); | 95 RefPtr<JSONObject> messageObject = value->asObject(); |
| 96 if (!messageObject) | 96 if (!messageObject) |
| 97 return; | 97 return; |
| 98 m_frontend->dispatchMessageFromWorker(m_id, messageObject); | 98 m_frontend->dispatchMessageFromWorker(m_id, messageObject); |
| 99 } | 99 } |
| 100 | 100 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 m_idToChannel.set(channel->id(), channel); | 258 m_idToChannel.set(channel->id(), channel); |
| 259 | 259 |
| 260 ASSERT(m_frontend); | 260 ASSERT(m_frontend); |
| 261 bool autoconnectToWorkers = m_state->getBoolean(WorkerAgentState::autoconnec
tToWorkers); | 261 bool autoconnectToWorkers = m_state->getBoolean(WorkerAgentState::autoconnec
tToWorkers); |
| 262 if (autoconnectToWorkers) | 262 if (autoconnectToWorkers) |
| 263 channel->connectToWorker(); | 263 channel->connectToWorker(); |
| 264 m_frontend->workerCreated(channel->id(), url, autoconnectToWorkers); | 264 m_frontend->workerCreated(channel->id(), url, autoconnectToWorkers); |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace blink | 267 } // namespace blink |
| OLD | NEW |