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

Side by Side Diff: components/sync/core/sync_db_util.cc

Issue 2413313004: [Sync] Move the last things out of core/. (Closed)
Patch Set: Address comments. Created 4 years, 2 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 2014 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 #include "components/sync/base/sync_db_util.h"
6
7 #include "base/files/file_path.h"
8 #include "base/single_thread_task_runner.h"
9 #include "components/sync/syncable/directory.h"
10 #include "sql/connection.h"
11
12 namespace syncer {
13
14 void CheckSyncDbLastModifiedTime(
15 const base::FilePath& sync_dir,
16 scoped_refptr<base::SingleThreadTaskRunner> callback_runner,
17 base::Callback<void(base::Time)> callback) {
18 const base::FilePath sync_db =
19 sync_dir.Append(syncable::Directory::kSyncDatabaseFilename);
20
21 base::File f(sync_db, base::File::FLAG_OPEN | base::File::FLAG_READ);
22 base::File::Info info;
23 if (!f.IsValid() || !f.GetInfo(&info)) {
24 callback_runner->PostTask(FROM_HERE, base::Bind(callback, base::Time()));
25 return;
26 }
27 f.Close();
28
29 sql::Connection db;
30 if (!db.Open(sync_db) || !db.QuickIntegrityCheck()) {
31 callback_runner->PostTask(FROM_HERE, base::Bind(callback, base::Time()));
32 } else {
33 callback_runner->PostTask(FROM_HERE,
34 base::Bind(callback, info.last_modified));
35 }
36 }
37
38 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/core/sync_auth_provider.h ('k') | components/sync/core/sync_encryption_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698