| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 84                base::TimeDelta::FromMinutes(2), | 84                base::TimeDelta::FromMinutes(2), | 
| 85                this, | 85                this, | 
| 86                &ActivityDatabase::RecordBatchedActions); | 86                &ActivityDatabase::RecordBatchedActions); | 
| 87 } | 87 } | 
| 88 | 88 | 
| 89 void ActivityDatabase::LogInitFailure() { | 89 void ActivityDatabase::LogInitFailure() { | 
| 90   LOG(ERROR) << "Couldn't initialize the activity log database."; | 90   LOG(ERROR) << "Couldn't initialize the activity log database."; | 
| 91   SoftFailureClose(); | 91   SoftFailureClose(); | 
| 92 } | 92 } | 
| 93 | 93 | 
| 94 void ActivityDatabase::NotifyAction() { | 94 void ActivityDatabase::AdviseFlush(int size) { | 
| 95   if (valid_db_ && !batch_mode_) { | 95   if (!valid_db_) | 
|  | 96     return; | 
|  | 97   if (!batch_mode_ || size == kFlushImmediately) { | 
| 96     if (!delegate_->FlushDatabase(&db_)) | 98     if (!delegate_->FlushDatabase(&db_)) | 
| 97       SoftFailureClose(); | 99       SoftFailureClose(); | 
| 98   } | 100   } | 
| 99 } | 101 } | 
| 100 | 102 | 
| 101 void ActivityDatabase::RecordBatchedActions() { | 103 void ActivityDatabase::RecordBatchedActions() { | 
| 102   if (valid_db_) { | 104   if (valid_db_) { | 
| 103     if (!delegate_->FlushDatabase(&db_)) | 105     if (!delegate_->FlushDatabase(&db_)) | 
| 104       SoftFailureClose(); | 106       SoftFailureClose(); | 
| 105   } | 107   } | 
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 213              field_types[i]); | 215              field_types[i]); | 
| 214         if (!db->Execute(table_updater.c_str())) | 216         if (!db->Execute(table_updater.c_str())) | 
| 215           return false; | 217           return false; | 
| 216       } | 218       } | 
| 217     } | 219     } | 
| 218   } | 220   } | 
| 219   return true; | 221   return true; | 
| 220 } | 222 } | 
| 221 | 223 | 
| 222 }  // namespace extensions | 224 }  // namespace extensions | 
| OLD | NEW | 
|---|