OLD | NEW |
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 25 matching lines...) Expand all Loading... |
36 // records, but not so large that too much space can be tied up holding records | 36 // records, but not so large that too much space can be tied up holding records |
37 // in memory. | 37 // in memory. |
38 static const int kSizeThresholdForFlush = 200; | 38 static const int kSizeThresholdForFlush = 200; |
39 | 39 |
40 ActivityDatabase::ActivityDatabase(ActivityDatabase::Delegate* delegate) | 40 ActivityDatabase::ActivityDatabase(ActivityDatabase::Delegate* delegate) |
41 : delegate_(delegate), | 41 : delegate_(delegate), |
42 valid_db_(false), | 42 valid_db_(false), |
43 batch_mode_(true), | 43 batch_mode_(true), |
44 already_closed_(false), | 44 already_closed_(false), |
45 did_init_(false) { | 45 did_init_(false) { |
46 if (CommandLine::ForCurrentProcess()->HasSwitch( | 46 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
47 switches::kEnableExtensionActivityLogTesting)) { | 47 switches::kEnableExtensionActivityLogTesting)) { |
48 batching_period_ = base::TimeDelta::FromSeconds(10); | 48 batching_period_ = base::TimeDelta::FromSeconds(10); |
49 } else { | 49 } else { |
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) { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |