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

Side by Side Diff: chrome/browser/chromeos/base/file_flusher.h

Issue 1815853002: cros: Flush profile files at critical moments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
(Empty)
1 // Copyright 2016 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 CHROME_BROWSER_CHROMEOS_BASE_FILE_FLUSHER_H_
6 #define CHROME_BROWSER_CHROMEOS_BASE_FILE_FLUSHER_H_
7
8 #include <vector>
9
10 #include "base/files/file_path.h"
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13
14 namespace chromeos {
15
16 // Flushes files under the requested directories in the blocking pool. If the
17 // same directory is requested more than once, the last request cancels all
18 // previous ones and start a new flushing process.
19 class FileFlusher {
20 public:
21 FileFlusher();
22 ~FileFlusher();
23
24 // Flush everything under |path| except the directories/files in |excludes|.
25 // |excluedes| can hold both absolute or relative paths, where absolute paths
26 // are used as-is and relative paths are appended to |path| to make it
27 // absolute.
28 void RequestFlush(const base::FilePath& path,
29 const std::vector<base::FilePath>& excludes);
30
31 private:
32 // Job for the flushing requests.
33 class Job;
34
35 // Starts the first job in |jobs_|.
36 void ScheduleJob();
37
38 // Invoked by a Job when it finishes.
39 void OnJobDone(Job* job);
40
41 // Not owned. Job manages its own life time.
42 std::vector<Job*> jobs_;
43
44 base::WeakPtrFactory<FileFlusher> weak_factory_;
45
46 DISALLOW_COPY_AND_ASSIGN(FileFlusher);
47 };
48
49 } // namespace chromeos
50
51 #endif // CHROME_BROWSER_CHROMEOS_BASE_FILE_FLUSHER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/base/file_flusher.cc » ('j') | chrome/browser/chromeos/base/file_flusher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698