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

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

Issue 2152373003: [Extensions] Code Cleanup - Remove redundant smart-ptr get()s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // A policy for storing activity log data to a database that performs 5 // A policy for storing activity log data to a database that performs
6 // aggregation to reduce the size of the database. The database layout is 6 // aggregation to reduce the size of the database. The database layout is
7 // nearly the same as FullStreamUIPolicy, which stores a complete log, with a 7 // nearly the same as FullStreamUIPolicy, which stores a complete log, with a
8 // few changes: 8 // few changes:
9 // - a "count" column is added to track how many log records were merged 9 // - a "count" column is added to track how many log records were merged
10 // together into this row 10 // together into this row
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 base::StringPrintf("%s, %s", insert_str.c_str(), matched_columns[i]); 282 base::StringPrintf("%s, %s", insert_str.c_str(), matched_columns[i]);
283 } 283 }
284 insert_str += ") VALUES (?, ?"; 284 insert_str += ") VALUES (?, ?";
285 for (size_t i = 0; i < arraysize(matched_columns); i++) { 285 for (size_t i = 0; i < arraysize(matched_columns); i++) {
286 insert_str += ", ?"; 286 insert_str += ", ?";
287 } 287 }
288 locate_str += " ORDER BY time DESC LIMIT 1"; 288 locate_str += " ORDER BY time DESC LIMIT 1";
289 insert_str += ")"; 289 insert_str += ")";
290 290
291 for (ActionQueue::iterator i = queue.begin(); i != queue.end(); ++i) { 291 for (ActionQueue::iterator i = queue.begin(); i != queue.end(); ++i) {
292 const Action& action = *i->first.get(); 292 const Action& action = *i->first;
293 int count = i->second; 293 int count = i->second;
294 294
295 base::Time day_start = action.time().LocalMidnight(); 295 base::Time day_start = action.time().LocalMidnight();
296 base::Time next_day = Util::AddDays(day_start, 1); 296 base::Time next_day = Util::AddDays(day_start, 1);
297 297
298 // The contents in values must match up with fields in matched_columns. A 298 // The contents in values must match up with fields in matched_columns. A
299 // value of -1 is used to encode a null database value. 299 // value of -1 is used to encode a null database value.
300 int64_t id; 300 int64_t id;
301 std::vector<int64_t> matched_values; 301 std::vector<int64_t> matched_values;
302 302
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 return true; 798 return true;
799 } 799 }
800 800
801 void CountingPolicy::Close() { 801 void CountingPolicy::Close() {
802 // The policy object should have never been created if there's no DB thread. 802 // The policy object should have never been created if there's no DB thread.
803 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::DB)); 803 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::DB));
804 ScheduleAndForget(activity_database(), &ActivityDatabase::Close); 804 ScheduleAndForget(activity_database(), &ActivityDatabase::Close);
805 } 805 }
806 806
807 } // namespace extensions 807 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698