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

Side by Side Diff: chrome/browser/tracing/navigation_tracing.cc

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/tracing/navigation_tracing.h" 5 #include "chrome/browser/tracing/navigation_tracing.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/command_line.h" 10 #include "base/command_line.h"
9 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/tracing/crash_service_uploader.h" 12 #include "chrome/browser/tracing/crash_service_uploader.h"
11 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
12 #include "components/tracing/tracing_switches.h" 14 #include "components/tracing/tracing_switches.h"
13 #include "content/public/browser/background_tracing_config.h" 15 #include "content/public/browser/background_tracing_config.h"
14 #include "content/public/browser/background_tracing_manager.h" 16 #include "content/public/browser/background_tracing_manager.h"
15 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/render_frame_host.h" 18 #include "content/public/browser/render_frame_host.h"
(...skipping 17 matching lines...) Expand all
34 } 36 }
35 37
36 void UploadCallback(const scoped_refptr<base::RefCountedString>& file_contents, 38 void UploadCallback(const scoped_refptr<base::RefCountedString>& file_contents,
37 scoped_ptr<const base::DictionaryValue> metadata, 39 scoped_ptr<const base::DictionaryValue> metadata,
38 base::Closure callback) { 40 base::Closure callback) {
39 TraceCrashServiceUploader* uploader = new TraceCrashServiceUploader( 41 TraceCrashServiceUploader* uploader = new TraceCrashServiceUploader(
40 g_browser_process->system_request_context()); 42 g_browser_process->system_request_context());
41 43
42 uploader->DoUpload( 44 uploader->DoUpload(
43 file_contents->data(), content::TraceUploader::UNCOMPRESSED_UPLOAD, 45 file_contents->data(), content::TraceUploader::UNCOMPRESSED_UPLOAD,
44 metadata.Pass(), content::TraceUploader::UploadProgressCallback(), 46 std::move(metadata), content::TraceUploader::UploadProgressCallback(),
45 base::Bind(&OnUploadComplete, base::Owned(uploader), callback)); 47 base::Bind(&OnUploadComplete, base::Owned(uploader), callback));
46 } 48 }
47 49
48 } // namespace 50 } // namespace
49 51
50 void SetupNavigationTracing() { 52 void SetupNavigationTracing() {
51 const base::CommandLine& command_line = 53 const base::CommandLine& command_line =
52 *base::CommandLine::ForCurrentProcess(); 54 *base::CommandLine::ForCurrentProcess();
53 if (!command_line.HasSwitch(switches::kEnableNavigationTracing) || 55 if (!command_line.HasSwitch(switches::kEnableNavigationTracing) ||
54 !command_line.HasSwitch(switches::kTraceUploadURL)) { 56 !command_line.HasSwitch(switches::kTraceUploadURL)) {
55 NOTREACHED(); 57 NOTREACHED();
56 return; 58 return;
57 } 59 }
58 60
59 base::DictionaryValue dict; 61 base::DictionaryValue dict;
60 dict.SetString("mode", "REACTIVE_TRACING_MODE"); 62 dict.SetString("mode", "REACTIVE_TRACING_MODE");
61 63
62 scoped_ptr<base::ListValue> rules_list(new base::ListValue()); 64 scoped_ptr<base::ListValue> rules_list(new base::ListValue());
63 { 65 {
64 scoped_ptr<base::DictionaryValue> rules_dict(new base::DictionaryValue()); 66 scoped_ptr<base::DictionaryValue> rules_dict(new base::DictionaryValue());
65 rules_dict->SetString("rule", "TRACE_ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL"); 67 rules_dict->SetString("rule", "TRACE_ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL");
66 rules_dict->SetString("trigger_name", kNavigationTracingConfig); 68 rules_dict->SetString("trigger_name", kNavigationTracingConfig);
67 rules_dict->SetString("category", "BENCHMARK_DEEP"); 69 rules_dict->SetString("category", "BENCHMARK_DEEP");
68 rules_list->Append(rules_dict.Pass()); 70 rules_list->Append(std::move(rules_dict));
69 } 71 }
70 dict.Set("configs", rules_list.Pass()); 72 dict.Set("configs", std::move(rules_list));
71 73
72 scoped_ptr<content::BackgroundTracingConfig> config( 74 scoped_ptr<content::BackgroundTracingConfig> config(
73 content::BackgroundTracingConfig::FromDict(&dict)); 75 content::BackgroundTracingConfig::FromDict(&dict));
74 DCHECK(config); 76 DCHECK(config);
75 77
76 content::BackgroundTracingManager::GetInstance()->SetActiveScenario( 78 content::BackgroundTracingManager::GetInstance()->SetActiveScenario(
77 config.Pass(), base::Bind(&UploadCallback), 79 std::move(config), base::Bind(&UploadCallback),
78 content::BackgroundTracingManager::NO_DATA_FILTERING); 80 content::BackgroundTracingManager::NO_DATA_FILTERING);
79 } 81 }
80 82
81 bool NavigationTracingObserver::IsEnabled() { 83 bool NavigationTracingObserver::IsEnabled() {
82 return content::BackgroundTracingManager::GetInstance()->HasActiveScenario(); 84 return content::BackgroundTracingManager::GetInstance()->HasActiveScenario();
83 } 85 }
84 86
85 NavigationTracingObserver::NavigationTracingObserver( 87 NavigationTracingObserver::NavigationTracingObserver(
86 content::WebContents* web_contents) 88 content::WebContents* web_contents)
87 : content::WebContentsObserver(web_contents) { 89 : content::WebContentsObserver(web_contents) {
(...skipping 16 matching lines...) Expand all
104 content::BackgroundTracingManager::GetInstance()->TriggerNamedEvent( 106 content::BackgroundTracingManager::GetInstance()->TriggerNamedEvent(
105 navigation_handle, 107 navigation_handle,
106 content::BackgroundTracingManager::StartedFinalizingCallback()); 108 content::BackgroundTracingManager::StartedFinalizingCallback());
107 } 109 }
108 } 110 }
109 111
110 content::BackgroundTracingManager::TriggerHandle 112 content::BackgroundTracingManager::TriggerHandle
111 NavigationTracingObserver::navigation_handle = -1; 113 NavigationTracingObserver::navigation_handle = -1;
112 114
113 } // namespace tracing 115 } // namespace tracing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698