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

Side by Side Diff: content/browser/devtools/service_worker_devtools_agent_host.h

Issue 2654993006: Show service worker navigation preload requests in DevTools Network tab. (Closed)
Patch Set: incorporated pfeldman's comment Created 3 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SERVICE_WORKER_DEVTOOLS_AGENT_HOST_H_ 5 #ifndef CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_AGENT_HOST_H_
6 #define CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_AGENT_HOST_H_ 6 #define CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_AGENT_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/browser/devtools/service_worker_devtools_manager.h" 14 #include "content/browser/devtools/service_worker_devtools_manager.h"
15 #include "content/browser/devtools/worker_devtools_agent_host.h" 15 #include "content/browser/devtools/worker_devtools_agent_host.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 struct ResourceRequest;
20 struct ResourceResponseHead;
21 struct ResourceRequestCompletionStatus;
22
19 class ServiceWorkerDevToolsAgentHost : public WorkerDevToolsAgentHost { 23 class ServiceWorkerDevToolsAgentHost : public WorkerDevToolsAgentHost {
20 public: 24 public:
21 using List = std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>; 25 using List = std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>;
22 using Map = std::map<std::string, 26 using Map = std::map<std::string,
23 scoped_refptr<ServiceWorkerDevToolsAgentHost>>; 27 scoped_refptr<ServiceWorkerDevToolsAgentHost>>;
24 using ServiceWorkerIdentifier = 28 using ServiceWorkerIdentifier =
25 ServiceWorkerDevToolsManager::ServiceWorkerIdentifier; 29 ServiceWorkerDevToolsManager::ServiceWorkerIdentifier;
26 30
27 ServiceWorkerDevToolsAgentHost(WorkerId worker_id, 31 ServiceWorkerDevToolsAgentHost(WorkerId worker_id,
28 const ServiceWorkerIdentifier& service_worker, 32 const ServiceWorkerIdentifier& service_worker,
29 bool is_installed_version); 33 bool is_installed_version);
30 34
31 void UnregisterWorker(); 35 void UnregisterWorker();
32 36
33 // DevToolsAgentHost overrides. 37 // DevToolsAgentHost overrides.
34 std::string GetType() override; 38 std::string GetType() override;
35 std::string GetTitle() override; 39 std::string GetTitle() override;
36 GURL GetURL() override; 40 GURL GetURL() override;
37 bool Activate() override; 41 bool Activate() override;
38 void Reload() override; 42 void Reload() override;
39 bool Close() override; 43 bool Close() override;
40 44
41 // WorkerDevToolsAgentHost overrides. 45 // WorkerDevToolsAgentHost overrides.
42 void OnAttachedStateChanged(bool attached) override; 46 void OnAttachedStateChanged(bool attached) override;
43 47
44 void WorkerVersionInstalled(); 48 void WorkerVersionInstalled();
45 void WorkerVersionDoomed(); 49 void WorkerVersionDoomed();
46 50
51 void NavigationPreloadRequestSent(const std::string& request_id,
52 const ResourceRequest& request);
53 void NavigationPreloadResponseReceived(const std::string& request_id,
54 const GURL& url,
55 const ResourceResponseHead& head);
56 void NavigationPreloadCompleted(
57 const std::string& request_id,
58 const ResourceRequestCompletionStatus& completion_status);
59
47 int64_t service_worker_version_id() const; 60 int64_t service_worker_version_id() const;
48 GURL scope() const; 61 GURL scope() const;
49 62
50 // If the ServiceWorker has been installed before the worker instance started, 63 // If the ServiceWorker has been installed before the worker instance started,
51 // it returns the time when the instance started. Otherwise returns the time 64 // it returns the time when the instance started. Otherwise returns the time
52 // when the ServiceWorker was installed. 65 // when the ServiceWorker was installed.
53 base::Time version_installed_time() const { return version_installed_time_; } 66 base::Time version_installed_time() const { return version_installed_time_; }
54 67
55 // Returns the time when the ServiceWorker was doomed. 68 // Returns the time when the ServiceWorker was doomed.
56 base::Time version_doomed_time() const { return version_doomed_time_; } 69 base::Time version_doomed_time() const { return version_doomed_time_; }
57 70
58 bool Matches(const ServiceWorkerIdentifier& other); 71 bool Matches(const ServiceWorkerIdentifier& other);
59 72
60 private: 73 private:
61 ~ServiceWorkerDevToolsAgentHost() override; 74 ~ServiceWorkerDevToolsAgentHost() override;
62 std::unique_ptr<ServiceWorkerIdentifier> service_worker_; 75 std::unique_ptr<ServiceWorkerIdentifier> service_worker_;
63 base::Time version_installed_time_; 76 base::Time version_installed_time_;
64 base::Time version_doomed_time_; 77 base::Time version_doomed_time_;
65 78
66 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDevToolsAgentHost); 79 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDevToolsAgentHost);
67 }; 80 };
68 81
69 } // namespace content 82 } // namespace content
70 83
71 #endif // CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_AGENT_HOST_H_ 84 #endif // CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_AGENT_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol_config.json ('k') | content/browser/devtools/service_worker_devtools_agent_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698