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

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

Issue 503903004: Remove implicit conversions from scoped_refptr to T* in chrome/browser/extensions/activity_log/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: timeout insurance Created 6 years, 4 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 base::StringPrintf("%s, %s", insert_str.c_str(), matched_columns[i]); 276 base::StringPrintf("%s, %s", insert_str.c_str(), matched_columns[i]);
277 } 277 }
278 insert_str += ") VALUES (?, ?"; 278 insert_str += ") VALUES (?, ?";
279 for (size_t i = 0; i < arraysize(matched_columns); i++) { 279 for (size_t i = 0; i < arraysize(matched_columns); i++) {
280 insert_str += ", ?"; 280 insert_str += ", ?";
281 } 281 }
282 locate_str += " ORDER BY time DESC LIMIT 1"; 282 locate_str += " ORDER BY time DESC LIMIT 1";
283 insert_str += ")"; 283 insert_str += ")";
284 284
285 for (ActionQueue::iterator i = queue.begin(); i != queue.end(); ++i) { 285 for (ActionQueue::iterator i = queue.begin(); i != queue.end(); ++i) {
286 const Action& action = *i->first; 286 const Action& action = *i->first.get();
287 int count = i->second; 287 int count = i->second;
288 288
289 base::Time day_start = action.time().LocalMidnight(); 289 base::Time day_start = action.time().LocalMidnight();
290 base::Time next_day = Util::AddDays(day_start, 1); 290 base::Time next_day = Util::AddDays(day_start, 1);
291 291
292 // The contents in values must match up with fields in matched_columns. A 292 // The contents in values must match up with fields in matched_columns. A
293 // value of -1 is used to encode a null database value. 293 // value of -1 is used to encode a null database value.
294 int64 id; 294 int64 id;
295 std::vector<int64> matched_values; 295 std::vector<int64> matched_values;
296 296
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 return true; 792 return true;
793 } 793 }
794 794
795 void CountingPolicy::Close() { 795 void CountingPolicy::Close() {
796 // The policy object should have never been created if there's no DB thread. 796 // The policy object should have never been created if there's no DB thread.
797 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::DB)); 797 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::DB));
798 ScheduleAndForget(activity_database(), &ActivityDatabase::Close); 798 ScheduleAndForget(activity_database(), &ActivityDatabase::Close);
799 } 799 }
800 800
801 } // namespace extensions 801 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698