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

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

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 12 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 const std::string& page_url, 428 const std::string& page_url,
429 const std::string& arg_url, 429 const std::string& arg_url,
430 const int days_ago) { 430 const int days_ago) {
431 // Ensure data is flushed to the database first so that we query over all 431 // Ensure data is flushed to the database first so that we query over all
432 // data. 432 // data.
433 activity_database()->AdviseFlush(ActivityDatabase::kFlushImmediately); 433 activity_database()->AdviseFlush(ActivityDatabase::kFlushImmediately);
434 scoped_ptr<Action::ActionVector> actions(new Action::ActionVector()); 434 scoped_ptr<Action::ActionVector> actions(new Action::ActionVector());
435 435
436 sql::Connection* db = GetDatabaseConnection(); 436 sql::Connection* db = GetDatabaseConnection();
437 if (!db) 437 if (!db)
438 return actions.Pass(); 438 return actions;
439 439
440 // Build up the query based on which parameters were specified. 440 // Build up the query based on which parameters were specified.
441 std::string where_str = ""; 441 std::string where_str = "";
442 std::string where_next = ""; 442 std::string where_next = "";
443 if (!extension_id.empty()) { 443 if (!extension_id.empty()) {
444 where_str += "extension_id=?"; 444 where_str += "extension_id=?";
445 where_next = " AND "; 445 where_next = " AND ";
446 } 446 }
447 if (!api_name.empty()) { 447 if (!api_name.empty()) {
448 where_str += where_next + "api_name=?"; 448 where_str += where_next + "api_name=?";
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 base::JSONReader::Read(query.ColumnString(8)); 516 base::JSONReader::Read(query.ColumnString(8));
517 if (parsed_value && parsed_value->IsType(base::Value::TYPE_DICTIONARY)) { 517 if (parsed_value && parsed_value->IsType(base::Value::TYPE_DICTIONARY)) {
518 action->set_other(make_scoped_ptr( 518 action->set_other(make_scoped_ptr(
519 static_cast<base::DictionaryValue*>(parsed_value.release()))); 519 static_cast<base::DictionaryValue*>(parsed_value.release())));
520 } 520 }
521 } 521 }
522 action->set_count(query.ColumnInt(9)); 522 action->set_count(query.ColumnInt(9));
523 actions->push_back(action); 523 actions->push_back(action);
524 } 524 }
525 525
526 return actions.Pass(); 526 return actions;
527 } 527 }
528 528
529 void CountingPolicy::DoRemoveActions(const std::vector<int64_t>& action_ids) { 529 void CountingPolicy::DoRemoveActions(const std::vector<int64_t>& action_ids) {
530 if (action_ids.empty()) 530 if (action_ids.empty())
531 return; 531 return;
532 532
533 sql::Connection* db = GetDatabaseConnection(); 533 sql::Connection* db = GetDatabaseConnection();
534 if (!db) { 534 if (!db) {
535 LOG(ERROR) << "Unable to connect to database"; 535 LOG(ERROR) << "Unable to connect to database";
536 return; 536 return;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 return true; 797 return true;
798 } 798 }
799 799
800 void CountingPolicy::Close() { 800 void CountingPolicy::Close() {
801 // The policy object should have never been created if there's no DB thread. 801 // The policy object should have never been created if there's no DB thread.
802 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::DB)); 802 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::DB));
803 ScheduleAndForget(activity_database(), &ActivityDatabase::Close); 803 ScheduleAndForget(activity_database(), &ActivityDatabase::Close);
804 } 804 }
805 805
806 } // namespace extensions 806 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698