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

Side by Side Diff: content/browser/service_worker/embedded_worker_instance.h

Issue 1675613002: service worker: use 200 OK for update requests even in the no update case (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 virtual void OnReportException(const base::string16& error_message, 93 virtual void OnReportException(const base::string16& error_message,
94 int line_number, 94 int line_number,
95 int column_number, 95 int column_number,
96 const GURL& source_url) {} 96 const GURL& source_url) {}
97 virtual void OnReportConsoleMessage(int source_identifier, 97 virtual void OnReportConsoleMessage(int source_identifier,
98 int message_level, 98 int message_level,
99 const base::string16& message, 99 const base::string16& message,
100 int line_number, 100 int line_number,
101 const GURL& source_url) {} 101 const GURL& source_url) {}
102 // Returns false if the message is not handled by this listener. 102 // Returns false if the message is not handled by this listener.
103 virtual bool OnMessageReceived(const IPC::Message& message) = 0; 103 virtual bool OnMessageReceived(const IPC::Message& message);
104 }; 104 };
105 105
106 ~EmbeddedWorkerInstance(); 106 ~EmbeddedWorkerInstance();
107 107
108 // Starts the worker. It is invalid to call this when the worker is not in 108 // Starts the worker. It is invalid to call this when the worker is not in
109 // STOPPED status. |callback| is invoked after the worker script has been 109 // STOPPED status. |callback| is invoked after the worker script has been
110 // started and evaluated, or when an error occurs. 110 // started and evaluated, or when an error occurs. If |pause_after_download|
111 // is true, the worker pauses after loading until ResumeAfterDownload() is
112 // called.
111 void Start(int64_t service_worker_version_id, 113 void Start(int64_t service_worker_version_id,
112 const GURL& scope, 114 const GURL& scope,
113 const GURL& script_url, 115 const GURL& script_url,
114 const StatusCallback& callback); 116 const StatusCallback& callback,
117 bool pause_after_download = false);
michaeln 2016/02/06 01:13:58 i think our style guide prohibits default param va
falken 2016/02/10 05:40:40 AFAICT yes: https://google.github.io/styleguide/cp
115 118
116 // Stops the worker. It is invalid to call this when the worker is 119 // Stops the worker. It is invalid to call this when the worker is
117 // not in STARTING or RUNNING status. 120 // not in STARTING or RUNNING status.
118 // This returns false if stopping a worker fails immediately, e.g. when 121 // This returns false if stopping a worker fails immediately, e.g. when
119 // IPC couldn't be sent to the worker. 122 // IPC couldn't be sent to the worker.
120 ServiceWorkerStatusCode Stop(); 123 ServiceWorkerStatusCode Stop();
121 124
122 // Stops the worker if the worker is not being debugged (i.e. devtools is 125 // Stops the worker if the worker is not being debugged (i.e. devtools is
123 // not attached). This method is called by a stop-worker timer to kill 126 // not attached). This method is called by a stop-worker timer to kill
124 // idle workers. 127 // idle workers.
125 void StopIfIdle(); 128 void StopIfIdle();
126 129
127 // Sends |message| to the embedded worker running in the child process. 130 // Sends |message| to the embedded worker running in the child process.
128 // It is invalid to call this while the worker is not in STARTING or RUNNING 131 // It is invalid to call this while the worker is not in STARTING or RUNNING
129 // status. 132 // status.
130 ServiceWorkerStatusCode SendMessage(const IPC::Message& message); 133 ServiceWorkerStatusCode SendMessage(const IPC::Message& message);
131 134
135 // Resumes the worker if it paused after download.
136 void ResumeAfterDownload();
137
132 // Returns the ServiceRegistry for this worker. It is invalid to call this 138 // Returns the ServiceRegistry for this worker. It is invalid to call this
133 // when the worker is not in STARTING or RUNNING status. 139 // when the worker is not in STARTING or RUNNING status.
134 ServiceRegistry* GetServiceRegistry(); 140 ServiceRegistry* GetServiceRegistry();
135 141
136 int embedded_worker_id() const { return embedded_worker_id_; } 142 int embedded_worker_id() const { return embedded_worker_id_; }
137 Status status() const { return status_; } 143 Status status() const { return status_; }
138 StartingPhase starting_phase() const { 144 StartingPhase starting_phase() const {
139 DCHECK_EQ(STARTING, status()); 145 DCHECK_EQ(STARTING, status());
140 return starting_phase_; 146 return starting_phase_;
141 } 147 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 base::TimeTicks start_timing_; 290 base::TimeTicks start_timing_;
285 291
286 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; 292 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_;
287 293
288 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); 294 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance);
289 }; 295 };
290 296
291 } // namespace content 297 } // namespace content
292 298
293 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ 299 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698