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

Side by Side Diff: content/browser/devtools/protocol/service_worker_handler.h

Issue 998173002: Revise ServiceWorker DevTools protocols. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use DCHECK_CURRENTLY_ON 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
« no previous file with comments | « no previous file | content/browser/devtools/protocol/service_worker_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_ 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "content/browser/devtools/protocol/devtools_protocol_handler.h" 11 #include "content/browser/devtools/protocol/devtools_protocol_handler.h"
12 #include "content/browser/devtools/service_worker_devtools_agent_host.h" 12 #include "content/browser/devtools/service_worker_devtools_agent_host.h"
13 #include "content/browser/devtools/service_worker_devtools_manager.h" 13 #include "content/browser/devtools/service_worker_devtools_manager.h"
14 #include "content/browser/service_worker/service_worker_info.h" 14 #include "content/browser/service_worker/service_worker_info.h"
15 #include "content/public/browser/devtools_agent_host.h" 15 #include "content/public/browser/devtools_agent_host.h"
16 #include "content/public/browser/devtools_agent_host_client.h" 16 #include "content/public/browser/devtools_agent_host_client.h"
17 17
18 // Windows headers will redefine SendMessage. 18 // Windows headers will redefine SendMessage.
19 #ifdef SendMessage 19 #ifdef SendMessage
20 #undef SendMessage 20 #undef SendMessage
21 #endif 21 #endif
22 22
23 namespace content { 23 namespace content {
24 24
25 class RenderFrameHostImpl; 25 class RenderFrameHostImpl;
26 class ServiceWorkerContextWatcher;
26 class ServiceWorkerContextWrapper; 27 class ServiceWorkerContextWrapper;
27 28
28 namespace devtools { 29 namespace devtools {
29 namespace service_worker { 30 namespace service_worker {
30 31
31 class ServiceWorkerHandler : public DevToolsAgentHostClient, 32 class ServiceWorkerHandler : public DevToolsAgentHostClient,
32 public ServiceWorkerDevToolsManager::Observer { 33 public ServiceWorkerDevToolsManager::Observer {
33 public: 34 public:
34 typedef DevToolsProtocolClient::Response Response; 35 typedef DevToolsProtocolClient::Response Response;
35 36
(...skipping 11 matching lines...) Expand all
47 Response SendMessage(const std::string& worker_id, 48 Response SendMessage(const std::string& worker_id,
48 const std::string& message); 49 const std::string& message);
49 Response Stop(const std::string& worker_id); 50 Response Stop(const std::string& worker_id);
50 51
51 // WorkerDevToolsManager::Observer implementation. 52 // WorkerDevToolsManager::Observer implementation.
52 void WorkerCreated(ServiceWorkerDevToolsAgentHost* host) override; 53 void WorkerCreated(ServiceWorkerDevToolsAgentHost* host) override;
53 void WorkerReadyForInspection(ServiceWorkerDevToolsAgentHost* host) override; 54 void WorkerReadyForInspection(ServiceWorkerDevToolsAgentHost* host) override;
54 void WorkerDestroyed(ServiceWorkerDevToolsAgentHost* host) override; 55 void WorkerDestroyed(ServiceWorkerDevToolsAgentHost* host) override;
55 56
56 private: 57 private:
57 class ContextObserver;
58
59 // DevToolsAgentHostClient overrides. 58 // DevToolsAgentHostClient overrides.
60 void DispatchProtocolMessage(DevToolsAgentHost* agent_host, 59 void DispatchProtocolMessage(DevToolsAgentHost* agent_host,
61 const std::string& message) override; 60 const std::string& message) override;
62 void AgentHostClosed(DevToolsAgentHost* agent_host, 61 void AgentHostClosed(DevToolsAgentHost* agent_host,
63 bool replaced_with_another_client) override; 62 bool replaced_with_another_client) override;
64 63
65 void ReportWorkerCreated(ServiceWorkerDevToolsAgentHost* host); 64 void ReportWorkerCreated(ServiceWorkerDevToolsAgentHost* host);
66 void ReportWorkerTerminated(ServiceWorkerDevToolsAgentHost* host); 65 void ReportWorkerTerminated(ServiceWorkerDevToolsAgentHost* host);
67 66
68 void OnWorkerRegistrationUpdated( 67 void OnWorkerRegistrationUpdated(
69 const std::vector<ServiceWorkerRegistrationInfo>& registrations); 68 const std::vector<ServiceWorkerRegistrationInfo>& registrations);
70 void OnWorkerVersionUpdated( 69 void OnWorkerVersionUpdated(
71 const std::vector<ServiceWorkerVersionInfo>& registrations); 70 const std::vector<ServiceWorkerVersionInfo>& registrations);
72 void OnWorkerRegistrationDeleted(int64 registration_id);
73 71
74 scoped_refptr<ServiceWorkerContextWrapper> context_; 72 scoped_refptr<ServiceWorkerContextWrapper> context_;
75 scoped_ptr<Client> client_; 73 scoped_ptr<Client> client_;
76 ServiceWorkerDevToolsAgentHost::Map attached_hosts_; 74 ServiceWorkerDevToolsAgentHost::Map attached_hosts_;
77 bool enabled_; 75 bool enabled_;
78 std::set<GURL> urls_; 76 std::set<GURL> urls_;
79 scoped_refptr<ContextObserver> context_observer_; 77 scoped_refptr<ServiceWorkerContextWatcher> context_watcher_;
80 RenderFrameHostImpl* render_frame_host_; 78 RenderFrameHostImpl* render_frame_host_;
81 79
82 base::WeakPtrFactory<ServiceWorkerHandler> weak_factory_; 80 base::WeakPtrFactory<ServiceWorkerHandler> weak_factory_;
83 81
84 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandler); 82 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandler);
85 }; 83 };
86 84
87 } // namespace service_worker 85 } // namespace service_worker
88 } // namespace devtools 86 } // namespace devtools
89 } // namespace content 87 } // namespace content
90 88
91 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_ 89 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/devtools/protocol/service_worker_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698