OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "content/browser/gpu/gpu_data_manager_impl_private.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h" |
6 | 6 |
| 7 #include <memory> |
| 8 #include <utility> |
| 9 |
7 #include "base/bind.h" | 10 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 12 #include "base/command_line.h" |
10 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
11 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
12 #include "base/metrics/sparse_histogram.h" | 15 #include "base/metrics/sparse_histogram.h" |
13 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
15 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
16 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 gpu_info_.process_crash_count = GpuProcessHost::gpu_crash_count(); | 907 gpu_info_.process_crash_count = GpuProcessHost::gpu_crash_count(); |
905 GpuDataManagerImpl::UnlockedSession session(owner_); | 908 GpuDataManagerImpl::UnlockedSession session(owner_); |
906 observer_list_->Notify( | 909 observer_list_->Notify( |
907 FROM_HERE, &GpuDataManagerObserver::OnGpuProcessCrashed, exit_code); | 910 FROM_HERE, &GpuDataManagerObserver::OnGpuProcessCrashed, exit_code); |
908 } | 911 } |
909 } | 912 } |
910 | 913 |
911 base::ListValue* GpuDataManagerImplPrivate::GetLogMessages() const { | 914 base::ListValue* GpuDataManagerImplPrivate::GetLogMessages() const { |
912 base::ListValue* value = new base::ListValue; | 915 base::ListValue* value = new base::ListValue; |
913 for (size_t ii = 0; ii < log_messages_.size(); ++ii) { | 916 for (size_t ii = 0; ii < log_messages_.size(); ++ii) { |
914 base::DictionaryValue* dict = new base::DictionaryValue(); | 917 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
915 dict->SetInteger("level", log_messages_[ii].level); | 918 dict->SetInteger("level", log_messages_[ii].level); |
916 dict->SetString("header", log_messages_[ii].header); | 919 dict->SetString("header", log_messages_[ii].header); |
917 dict->SetString("message", log_messages_[ii].message); | 920 dict->SetString("message", log_messages_[ii].message); |
918 value->Append(dict); | 921 value->Append(std::move(dict)); |
919 } | 922 } |
920 return value; | 923 return value; |
921 } | 924 } |
922 | 925 |
923 void GpuDataManagerImplPrivate::HandleGpuSwitch() { | 926 void GpuDataManagerImplPrivate::HandleGpuSwitch() { |
924 GpuDataManagerImpl::UnlockedSession session(owner_); | 927 GpuDataManagerImpl::UnlockedSession session(owner_); |
925 // Notify observers in the browser process. | 928 // Notify observers in the browser process. |
926 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); | 929 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); |
927 // Pass the notification to the GPU process to notify observers there. | 930 // Pass the notification to the GPU process to notify observers there. |
928 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 931 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1284 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1282 #if defined(OS_WIN) | 1285 #if defined(OS_WIN) |
1283 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1286 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1284 #endif | 1287 #endif |
1285 complete_gpu_info_already_requested_ = true; | 1288 complete_gpu_info_already_requested_ = true; |
1286 // Some observers might be waiting. | 1289 // Some observers might be waiting. |
1287 NotifyGpuInfoUpdate(); | 1290 NotifyGpuInfoUpdate(); |
1288 } | 1291 } |
1289 | 1292 |
1290 } // namespace content | 1293 } // namespace content |
OLD | NEW |