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

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

Issue 867903005: [ServiceWorkerCache] Serialize ServiceWorkerCacheStorage operations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from PS3 Created 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_SCHEDULER_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_SCHEDULER_H_
7
8 #include <list>
9
10 #include "base/callback.h"
11 #include "content/common/content_export.h"
12
13 namespace content {
14
15 class CONTENT_EXPORT ServiceWorkerCacheScheduler {
16 public:
17 ServiceWorkerCacheScheduler();
18 virtual ~ServiceWorkerCacheScheduler();
19
20 // Adds the operation to the tail of the queue and starts it if the scheduler
21 // is idle.
22 void ScheduleOperation(const base::Closure& closure);
23
24 // Call this after each operation completes. It cleans up the current
25 // operation and starts the next.
26 void CompleteOperationAndRunNext();
27
28 bool Empty() const;
29
30 private:
31 void RunOperationIfIdle();
32
33 // The list of operations waiting on initialization.
34 std::list<base::Closure> pending_operations_;
35 bool operation_running_;
36
37 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheScheduler);
38 };
39
40 } // namespace content
41
42 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698