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

Side by Side Diff: content/browser/devtools/protocol/system_info_handler.cc

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/devtools/protocol/system_info_handler.h" 5 #include "content/browser/devtools/protocol/system_info_handler.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8
8 #include <utility> 9 #include <utility>
9 10
10 #include "base/bind.h" 11 #include "base/bind.h"
11 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/memory/ptr_util.h"
12 #include "content/browser/gpu/compositor_util.h" 14 #include "content/browser/gpu/compositor_util.h"
13 #include "content/public/browser/gpu_data_manager.h" 15 #include "content/public/browser/gpu_data_manager.h"
14 #include "gpu/config/gpu_feature_type.h" 16 #include "gpu/config/gpu_feature_type.h"
15 #include "gpu/config/gpu_info.h" 17 #include "gpu/config/gpu_info.h"
16 #include "gpu/config/gpu_switches.h" 18 #include "gpu/config/gpu_switches.h"
17 19
18 namespace content { 20 namespace content {
19 namespace devtools { 21 namespace devtools {
20 namespace system_info { 22 namespace system_info {
21 23
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 140
139 int SystemInfoHandlerGpuObserver::next_observer_id_ = 0; 141 int SystemInfoHandlerGpuObserver::next_observer_id_ = 0;
140 142
141 SystemInfoHandler::SystemInfoHandler() 143 SystemInfoHandler::SystemInfoHandler()
142 : weak_factory_(this) { 144 : weak_factory_(this) {
143 } 145 }
144 146
145 SystemInfoHandler::~SystemInfoHandler() { 147 SystemInfoHandler::~SystemInfoHandler() {
146 } 148 }
147 149
148 void SystemInfoHandler::SetClient(scoped_ptr<Client> client) { 150 void SystemInfoHandler::SetClient(std::unique_ptr<Client> client) {
149 client_.swap(client); 151 client_.swap(client);
150 } 152 }
151 153
152 Response SystemInfoHandler::GetInfo(DevToolsCommandId command_id) { 154 Response SystemInfoHandler::GetInfo(DevToolsCommandId command_id) {
153 std::string reason; 155 std::string reason;
154 if (!GpuDataManager::GetInstance()->GpuAccessAllowed(&reason) || 156 if (!GpuDataManager::GetInstance()->GpuAccessAllowed(&reason) ||
155 GpuDataManager::GetInstance()->IsEssentialGpuInfoAvailable() || 157 GpuDataManager::GetInstance()->IsEssentialGpuInfoAvailable() ||
156 base::CommandLine::ForCurrentProcess()->HasSwitch( 158 base::CommandLine::ForCurrentProcess()->HasSwitch(
157 switches::kGpuTestingNoCompleteInfoCollection)) { 159 switches::kGpuTestingNoCompleteInfoCollection)) {
158 // The GpuDataManager already has all of the information needed to make 160 // The GpuDataManager already has all of the information needed to make
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 return Response::OK(); 192 return Response::OK();
191 } 193 }
192 194
193 void SystemInfoHandler::SendGetInfoResponse(DevToolsCommandId command_id) { 195 void SystemInfoHandler::SendGetInfoResponse(DevToolsCommandId command_id) {
194 gpu::GPUInfo gpu_info = GpuDataManager::GetInstance()->GetGPUInfo(); 196 gpu::GPUInfo gpu_info = GpuDataManager::GetInstance()->GetGPUInfo();
195 std::vector<scoped_refptr<GPUDevice>> devices; 197 std::vector<scoped_refptr<GPUDevice>> devices;
196 devices.push_back(GPUDeviceToProtocol(gpu_info.gpu)); 198 devices.push_back(GPUDeviceToProtocol(gpu_info.gpu));
197 for (const auto& device : gpu_info.secondary_gpus) 199 for (const auto& device : gpu_info.secondary_gpus)
198 devices.push_back(GPUDeviceToProtocol(device)); 200 devices.push_back(GPUDeviceToProtocol(device));
199 201
200 scoped_ptr<base::DictionaryValue> aux_attributes(new base::DictionaryValue); 202 std::unique_ptr<base::DictionaryValue> aux_attributes(
203 new base::DictionaryValue);
201 AuxGPUInfoEnumerator enumerator(aux_attributes.get()); 204 AuxGPUInfoEnumerator enumerator(aux_attributes.get());
202 gpu_info.EnumerateFields(&enumerator); 205 gpu_info.EnumerateFields(&enumerator);
203 206
204 scoped_refptr<GPUInfo> gpu = 207 scoped_refptr<GPUInfo> gpu =
205 GPUInfo::Create() 208 GPUInfo::Create()
206 ->set_devices(devices) 209 ->set_devices(devices)
207 ->set_aux_attributes(std::move(aux_attributes)) 210 ->set_aux_attributes(std::move(aux_attributes))
208 ->set_feature_status(make_scoped_ptr(GetFeatureStatus())) 211 ->set_feature_status(base::WrapUnique(GetFeatureStatus()))
209 ->set_driver_bug_workarounds(GetDriverBugWorkarounds()); 212 ->set_driver_bug_workarounds(GetDriverBugWorkarounds());
210 213
211 client_->SendGetInfoResponse( 214 client_->SendGetInfoResponse(
212 command_id, 215 command_id,
213 GetInfoResponse::Create()->set_gpu(gpu) 216 GetInfoResponse::Create()->set_gpu(gpu)
214 ->set_model_name(gpu_info.machine_model_name) 217 ->set_model_name(gpu_info.machine_model_name)
215 ->set_model_version(gpu_info.machine_model_version)); 218 ->set_model_version(gpu_info.machine_model_version));
216 } 219 }
217 220
218 void SystemInfoHandler::AddActiveObserverId(int observer_id) { 221 void SystemInfoHandler::AddActiveObserverId(int observer_id) {
(...skipping 14 matching lines...) Expand all
233 SendGetInfoResponse(command_id); 236 SendGetInfoResponse(command_id);
234 // For the time being we want to know about this event in the test logs. 237 // For the time being we want to know about this event in the test logs.
235 LOG(ERROR) << "SystemInfoHandler: request for GPU info timed out!" 238 LOG(ERROR) << "SystemInfoHandler: request for GPU info timed out!"
236 << " Most recent info sent."; 239 << " Most recent info sent.";
237 } 240 }
238 } 241 }
239 242
240 } // namespace system_info 243 } // namespace system_info
241 } // namespace devtools 244 } // namespace devtools
242 } // namespace content 245 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/system_info_handler.h ('k') | content/browser/devtools/protocol/tethering_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698