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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_database.cc

Issue 216513002: Replace DCHECK(BrowserThread::CurrentlyOn) with DCHECK_CURRENTLY_ON in extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/activity_log/activity_log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/activity_log/activity_database.h" 5 #include "chrome/browser/extensions/activity_log/activity_database.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 batching_period_ = base::TimeDelta::FromMinutes(2); 50 batching_period_ = base::TimeDelta::FromMinutes(2);
51 } 51 }
52 } 52 }
53 53
54 ActivityDatabase::~ActivityDatabase() {} 54 ActivityDatabase::~ActivityDatabase() {}
55 55
56 void ActivityDatabase::Init(const base::FilePath& db_name) { 56 void ActivityDatabase::Init(const base::FilePath& db_name) {
57 if (did_init_) return; 57 if (did_init_) return;
58 did_init_ = true; 58 did_init_ = true;
59 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB)) 59 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB))
60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 60 DCHECK_CURRENTLY_ON(BrowserThread::DB);
61 db_.set_histogram_tag("Activity"); 61 db_.set_histogram_tag("Activity");
62 db_.set_error_callback( 62 db_.set_error_callback(
63 base::Bind(&ActivityDatabase::DatabaseErrorCallback, 63 base::Bind(&ActivityDatabase::DatabaseErrorCallback,
64 base::Unretained(this))); 64 base::Unretained(this)));
65 db_.set_page_size(4096); 65 db_.set_page_size(4096);
66 db_.set_cache_size(32); 66 db_.set_cache_size(32);
67 67
68 if (!db_.Open(db_name)) { 68 if (!db_.Open(db_name)) {
69 LOG(ERROR) << db_.GetErrorMessage(); 69 LOG(ERROR) << db_.GetErrorMessage();
70 return LogInitFailure(); 70 return LogInitFailure();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 &ActivityDatabase::RecordBatchedActions); 129 &ActivityDatabase::RecordBatchedActions);
130 } else if (!batch_mode && batch_mode_) { 130 } else if (!batch_mode && batch_mode_) {
131 timer_.Stop(); 131 timer_.Stop();
132 RecordBatchedActions(); 132 RecordBatchedActions();
133 } 133 }
134 batch_mode_ = batch_mode; 134 batch_mode_ = batch_mode;
135 } 135 }
136 136
137 sql::Connection* ActivityDatabase::GetSqlConnection() { 137 sql::Connection* ActivityDatabase::GetSqlConnection() {
138 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB)) 138 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB))
139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 139 DCHECK_CURRENTLY_ON(BrowserThread::DB);
140 if (valid_db_) { 140 if (valid_db_) {
141 return &db_; 141 return &db_;
142 } else { 142 } else {
143 LOG(WARNING) << "Activity log database is not valid"; 143 LOG(WARNING) << "Activity log database is not valid";
144 return NULL; 144 return NULL;
145 } 145 }
146 } 146 }
147 147
148 void ActivityDatabase::Close() { 148 void ActivityDatabase::Close() {
149 timer_.Stop(); 149 timer_.Stop();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 field_types[i]); 229 field_types[i]);
230 if (!db->Execute(table_updater.c_str())) 230 if (!db->Execute(table_updater.c_str()))
231 return false; 231 return false;
232 } 232 }
233 } 233 }
234 } 234 }
235 return true; 235 return true;
236 } 236 }
237 237
238 } // namespace extensions 238 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/activity_log/activity_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698