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

Side by Side Diff: components/enhanced_bookmarks/persistent_image_store.cc

Issue 1546143002: Switch to standard integer types in components/, 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 2014 The Chromium Authors. All rights reserved. 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 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 "components/enhanced_bookmarks/persistent_image_store.h" 5 #include "components/enhanced_bookmarks/persistent_image_store.h"
6 6
7 #include <stddef.h>
8
7 #include "base/files/file.h" 9 #include "base/files/file.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "components/enhanced_bookmarks/image_store_util.h" 11 #include "components/enhanced_bookmarks/image_store_util.h"
10 #include "sql/statement.h" 12 #include "sql/statement.h"
11 #include "sql/transaction.h" 13 #include "sql/transaction.h"
12 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
13 #include "url/gurl.h" 15 #include "url/gurl.h"
14 16
15 namespace { 17 namespace {
16 // Current version number. Databases are written at the "current" version 18 // Current version number. Databases are written at the "current" version
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 void PersistentImageStore::ClearAll() { 302 void PersistentImageStore::ClearAll() {
301 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 303 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
302 if (OpenDatabase() != sql::INIT_OK) 304 if (OpenDatabase() != sql::INIT_OK)
303 return; 305 return;
304 306
305 sql::Statement statement(db_.GetCachedStatement( 307 sql::Statement statement(db_.GetCachedStatement(
306 SQL_FROM_HERE, "DELETE FROM images_by_url")); 308 SQL_FROM_HERE, "DELETE FROM images_by_url"));
307 statement.Run(); 309 statement.Run();
308 } 310 }
309 311
310 int64 PersistentImageStore::GetStoreSizeInBytes() { 312 int64_t PersistentImageStore::GetStoreSizeInBytes() {
311 base::File file(path_, base::File::FLAG_OPEN | base::File::FLAG_READ); 313 base::File file(path_, base::File::FLAG_OPEN | base::File::FLAG_READ);
312 return file.IsValid() ? file.GetLength() : -1; 314 return file.IsValid() ? file.GetLength() : -1;
313 } 315 }
314 316
315 PersistentImageStore::~PersistentImageStore() { 317 PersistentImageStore::~PersistentImageStore() {
316 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 318 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
317 } 319 }
318 320
319 sql::InitStatus PersistentImageStore::OpenDatabase() { 321 sql::InitStatus PersistentImageStore::OpenDatabase() {
320 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 322 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
(...skipping 11 matching lines...) Expand all
332 334
333 // Can't open, raze(). 335 // Can't open, raze().
334 if (db_.is_open()) 336 if (db_.is_open())
335 db_.Raze(); 337 db_.Raze();
336 db_.Close(); 338 db_.Close();
337 } 339 }
338 340
339 DCHECK(false) << "Can't open image DB"; 341 DCHECK(false) << "Can't open image DB";
340 return sql::INIT_FAILURE; 342 return sql::INIT_FAILURE;
341 } 343 }
OLDNEW
« no previous file with comments | « components/enhanced_bookmarks/persistent_image_store.h ('k') | components/enhanced_bookmarks/test_image_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698