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

Side by Side Diff: base/trace_event/trace_config.cc

Issue 1479473002: base: Use std::move() instead of Pass() for real movable types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: basepass: missing-include Created 5 years 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
« no previous file with comments | « base/trace_event/trace_buffer.cc ('k') | base/trace_event/trace_event_argument.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "base/trace_event/trace_config.h" 5 #include "base/trace_event/trace_config.h"
6 6
7 #include <utility>
8
7 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
9 #include "base/strings/pattern.h" 11 #include "base/strings/pattern.h"
10 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
11 #include "base/strings/string_tokenizer.h" 13 #include "base/strings/string_tokenizer.h"
12 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
13 #include "base/trace_event/memory_dump_manager.h" 15 #include "base/trace_event/memory_dump_manager.h"
14 #include "base/trace_event/memory_dump_request_args.h" 16 #include "base/trace_event/memory_dump_request_args.h"
15 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
16 18
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 if (categories.empty()) 461 if (categories.empty())
460 return; 462 return;
461 463
462 scoped_ptr<base::ListValue> list(new base::ListValue()); 464 scoped_ptr<base::ListValue> list(new base::ListValue());
463 for (StringList::const_iterator ci = categories.begin(); 465 for (StringList::const_iterator ci = categories.begin();
464 ci != categories.end(); 466 ci != categories.end();
465 ++ci) { 467 ++ci) {
466 list->AppendString(*ci); 468 list->AppendString(*ci);
467 } 469 }
468 470
469 dict.Set(param, list.Pass()); 471 dict.Set(param, std::move(list));
470 } 472 }
471 473
472 void TraceConfig::SetMemoryDumpConfig( 474 void TraceConfig::SetMemoryDumpConfig(
473 const base::DictionaryValue& memory_dump_config) { 475 const base::DictionaryValue& memory_dump_config) {
474 memory_dump_config_.clear(); 476 memory_dump_config_.clear();
475 477
476 const base::ListValue* trigger_list = nullptr; 478 const base::ListValue* trigger_list = nullptr;
477 if (!memory_dump_config.GetList(kTriggersParam, &trigger_list) || 479 if (!memory_dump_config.GetList(kTriggersParam, &trigger_list) ||
478 trigger_list->GetSize() == 0) { 480 trigger_list->GetSize() == 0) {
479 return; 481 return;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 scoped_ptr<base::DictionaryValue> memory_dump_config( 553 scoped_ptr<base::DictionaryValue> memory_dump_config(
552 new base::DictionaryValue()); 554 new base::DictionaryValue());
553 scoped_ptr<base::ListValue> triggers_list(new base::ListValue()); 555 scoped_ptr<base::ListValue> triggers_list(new base::ListValue());
554 for (const MemoryDumpTriggerConfig& config : memory_dump_config_) { 556 for (const MemoryDumpTriggerConfig& config : memory_dump_config_) {
555 scoped_ptr<base::DictionaryValue> trigger_dict( 557 scoped_ptr<base::DictionaryValue> trigger_dict(
556 new base::DictionaryValue()); 558 new base::DictionaryValue());
557 trigger_dict->SetInteger(kPeriodicIntervalParam, 559 trigger_dict->SetInteger(kPeriodicIntervalParam,
558 static_cast<int>(config.periodic_interval_ms)); 560 static_cast<int>(config.periodic_interval_ms));
559 trigger_dict->SetString( 561 trigger_dict->SetString(
560 kModeParam, MemoryDumpLevelOfDetailToString(config.level_of_detail)); 562 kModeParam, MemoryDumpLevelOfDetailToString(config.level_of_detail));
561 triggers_list->Append(trigger_dict.Pass()); 563 triggers_list->Append(std::move(trigger_dict));
562 } 564 }
563 565
564 // Empty triggers will still be specified explicitly since it means that 566 // Empty triggers will still be specified explicitly since it means that
565 // the periodic dumps are not enabled. 567 // the periodic dumps are not enabled.
566 memory_dump_config->Set(kTriggersParam, triggers_list.Pass()); 568 memory_dump_config->Set(kTriggersParam, std::move(triggers_list));
567 dict.Set(kMemoryDumpConfigParam, memory_dump_config.Pass()); 569 dict.Set(kMemoryDumpConfigParam, std::move(memory_dump_config));
568 } 570 }
569 } 571 }
570 572
571 std::string TraceConfig::ToTraceOptionsString() const { 573 std::string TraceConfig::ToTraceOptionsString() const {
572 std::string ret; 574 std::string ret;
573 switch (record_mode_) { 575 switch (record_mode_) {
574 case RECORD_UNTIL_FULL: 576 case RECORD_UNTIL_FULL:
575 ret = kRecordUntilFull; 577 ret = kRecordUntilFull;
576 break; 578 break;
577 case RECORD_CONTINUOUSLY: 579 case RECORD_CONTINUOUSLY:
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 str.at(0) == ' ' || 656 str.at(0) == ' ' ||
655 str.at(str.length() - 1) == ' '; 657 str.at(str.length() - 1) == ' ';
656 } 658 }
657 659
658 bool TraceConfig::HasIncludedPatterns() const { 660 bool TraceConfig::HasIncludedPatterns() const {
659 return !included_categories_.empty(); 661 return !included_categories_.empty();
660 } 662 }
661 663
662 } // namespace trace_event 664 } // namespace trace_event
663 } // namespace base 665 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_buffer.cc ('k') | base/trace_event/trace_event_argument.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698