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

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

Issue 2166523003: Add ref count to service workers for extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 <memory> 10 #include <memory>
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 // Add message to the devtools console. 190 // Add message to the devtools console.
191 void AddMessageToConsole(ConsoleMessageLevel level, 191 void AddMessageToConsole(ConsoleMessageLevel level,
192 const std::string& message); 192 const std::string& message);
193 193
194 static std::string StatusToString(EmbeddedWorkerStatus status); 194 static std::string StatusToString(EmbeddedWorkerStatus status);
195 static std::string StartingPhaseToString(StartingPhase phase); 195 static std::string StartingPhaseToString(StartingPhase phase);
196 196
197 void Detach(); 197 void Detach();
198 198
199 void IncrementRefCount();
200 void DecrementRefCount();
falken 2016/07/22 05:06:01 ref count is kind of generic, maybe "IncrementPend
lazyboy 2016/07/26 17:45:48 Done.
201
199 base::WeakPtr<EmbeddedWorkerInstance> AsWeakPtr(); 202 base::WeakPtr<EmbeddedWorkerInstance> AsWeakPtr();
200 203
201 private: 204 private:
202 typedef base::ObserverList<Listener> ListenerList; 205 typedef base::ObserverList<Listener> ListenerList;
203 class DevToolsProxy; 206 class DevToolsProxy;
204 class StartTask; 207 class StartTask;
205 class WorkerProcessHandle; 208 class WorkerProcessHandle;
206 friend class EmbeddedWorkerRegistry; 209 friend class EmbeddedWorkerRegistry;
207 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop); 210 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop);
208 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, DetachDuringStart); 211 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, DetachDuringStart);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 320
318 std::unique_ptr<StartTask> inflight_start_task_; 321 std::unique_ptr<StartTask> inflight_start_task_;
319 322
320 // This is valid only after a process is allocated for the worker. 323 // This is valid only after a process is allocated for the worker.
321 ServiceWorkerMetrics::StartSituation start_situation_ = 324 ServiceWorkerMetrics::StartSituation start_situation_ =
322 ServiceWorkerMetrics::StartSituation::UNKNOWN; 325 ServiceWorkerMetrics::StartSituation::UNKNOWN;
323 326
324 // Used for UMA. The start time of the current start sequence step. 327 // Used for UMA. The start time of the current start sequence step.
325 base::TimeTicks step_time_; 328 base::TimeTicks step_time_;
326 329
330 int external_ref_count_;
331
327 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; 332 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_;
328 333
329 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); 334 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance);
330 }; 335 };
331 336
332 } // namespace content 337 } // namespace content
333 338
334 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ 339 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698