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

Side by Side Diff: chrome/browser/android/history_report/delta_file_service.cc

Issue 1542413002: Switch to standard integer types in chrome/browser/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 2015 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/android/history_report/delta_file_service.h" 5 #include "chrome/browser/android/history_report/delta_file_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "chrome/browser/android/history_report/delta_file_backend_leveldb.h" 10 #include "chrome/browser/android/history_report/delta_file_backend_leveldb.h"
11 #include "chrome/browser/android/history_report/delta_file_commons.h" 11 #include "chrome/browser/android/history_report/delta_file_commons.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 14
15 namespace { 15 namespace {
16 16
17 void DoAddPage(history_report::DeltaFileBackend* backend, const GURL& url) { 17 void DoAddPage(history_report::DeltaFileBackend* backend, const GURL& url) {
18 backend->PageAdded(url); 18 backend->PageAdded(url);
19 } 19 }
20 20
21 void DoDeletePage(history_report::DeltaFileBackend* backend, const GURL& url) { 21 void DoDeletePage(history_report::DeltaFileBackend* backend, const GURL& url) {
22 backend->PageDeleted(url); 22 backend->PageDeleted(url);
23 } 23 }
24 24
25 void DoTrim(history_report::DeltaFileBackend* backend, 25 void DoTrim(history_report::DeltaFileBackend* backend,
26 int64 lower_bound, 26 int64_t lower_bound,
27 base::WaitableEvent* finished, 27 base::WaitableEvent* finished,
28 int64* result) { 28 int64_t* result) {
29 *result = backend->Trim(lower_bound); 29 *result = backend->Trim(lower_bound);
30 finished->Signal(); 30 finished->Signal();
31 } 31 }
32 32
33 void DoQuery( 33 void DoQuery(
34 history_report::DeltaFileBackend* backend, 34 history_report::DeltaFileBackend* backend,
35 int64 last_seq_no, 35 int64_t last_seq_no,
36 int32 limit, 36 int32_t limit,
37 base::WaitableEvent* finished, 37 base::WaitableEvent* finished,
38 scoped_ptr<std::vector<history_report::DeltaFileEntryWithData> >* result) { 38 scoped_ptr<std::vector<history_report::DeltaFileEntryWithData>>* result) {
39 *result = backend->Query(last_seq_no, limit).Pass(); 39 *result = backend->Query(last_seq_no, limit).Pass();
40 finished->Signal(); 40 finished->Signal();
41 } 41 }
42 42
43 void DoRecreate(history_report::DeltaFileBackend* backend, 43 void DoRecreate(history_report::DeltaFileBackend* backend,
44 const std::vector<std::string>& urls, 44 const std::vector<std::string>& urls,
45 base::WaitableEvent* finished, 45 base::WaitableEvent* finished,
46 bool* result) { 46 bool* result) {
47 *result = backend->Recreate(urls); 47 *result = backend->Recreate(urls);
48 finished->Signal(); 48 finished->Signal();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); 87 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
88 pool->PostSequencedWorkerTaskWithShutdownBehavior( 88 pool->PostSequencedWorkerTaskWithShutdownBehavior(
89 worker_pool_token_, 89 worker_pool_token_,
90 FROM_HERE, 90 FROM_HERE,
91 base::Bind(&DoDeletePage, 91 base::Bind(&DoDeletePage,
92 base::Unretained(delta_file_backend_.get()), 92 base::Unretained(delta_file_backend_.get()),
93 url), 93 url),
94 base::SequencedWorkerPool::BLOCK_SHUTDOWN); 94 base::SequencedWorkerPool::BLOCK_SHUTDOWN);
95 } 95 }
96 96
97 int64 DeltaFileService::Trim(int64 lower_bound) { 97 int64_t DeltaFileService::Trim(int64_t lower_bound) {
98 int64 result; 98 int64_t result;
99 base::WaitableEvent finished(false, false); 99 base::WaitableEvent finished(false, false);
100 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); 100 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
101 pool->PostSequencedWorkerTaskWithShutdownBehavior( 101 pool->PostSequencedWorkerTaskWithShutdownBehavior(
102 worker_pool_token_, 102 worker_pool_token_,
103 FROM_HERE, 103 FROM_HERE,
104 base::Bind(&DoTrim, 104 base::Bind(&DoTrim,
105 base::Unretained(delta_file_backend_.get()), 105 base::Unretained(delta_file_backend_.get()),
106 lower_bound, 106 lower_bound,
107 base::Unretained(&finished), 107 base::Unretained(&finished),
108 base::Unretained(&result)), 108 base::Unretained(&result)),
109 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); 109 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
110 finished.Wait(); 110 finished.Wait();
111 return result; 111 return result;
112 } 112 }
113 113
114 scoped_ptr<std::vector<DeltaFileEntryWithData> > DeltaFileService::Query( 114 scoped_ptr<std::vector<DeltaFileEntryWithData>> DeltaFileService::Query(
115 int64 last_seq_no, 115 int64_t last_seq_no,
116 int32 limit) { 116 int32_t limit) {
117 scoped_ptr<std::vector<DeltaFileEntryWithData> > result; 117 scoped_ptr<std::vector<DeltaFileEntryWithData> > result;
118 base::WaitableEvent finished(false, false); 118 base::WaitableEvent finished(false, false);
119 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); 119 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
120 pool->PostSequencedWorkerTaskWithShutdownBehavior( 120 pool->PostSequencedWorkerTaskWithShutdownBehavior(
121 worker_pool_token_, 121 worker_pool_token_,
122 FROM_HERE, 122 FROM_HERE,
123 base::Bind(&DoQuery, 123 base::Bind(&DoQuery,
124 base::Unretained(delta_file_backend_.get()), 124 base::Unretained(delta_file_backend_.get()),
125 last_seq_no, 125 last_seq_no,
126 limit, 126 limit,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 base::Bind(&DoDump, 168 base::Bind(&DoDump,
169 base::Unretained(delta_file_backend_.get()), 169 base::Unretained(delta_file_backend_.get()),
170 base::Unretained(&finished), 170 base::Unretained(&finished),
171 base::Unretained(&dump)), 171 base::Unretained(&dump)),
172 base::SequencedWorkerPool::BLOCK_SHUTDOWN); 172 base::SequencedWorkerPool::BLOCK_SHUTDOWN);
173 finished.Wait(); 173 finished.Wait();
174 return dump; 174 return dump;
175 } 175 }
176 176
177 } // namespace history_report 177 } // namespace history_report
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698