| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/gpu/gpu_benchmarking_extension.h" | 5 #include "content/renderer/gpu/gpu_benchmarking_extension.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 // Recursively serializes the layer tree. | 121 // Recursively serializes the layer tree. |
| 122 // Each layer in the tree is serialized into a separate skp file | 122 // Each layer in the tree is serialized into a separate skp file |
| 123 // in the given directory. | 123 // in the given directory. |
| 124 void Serialize(const cc::Layer* layer) { | 124 void Serialize(const cc::Layer* layer) { |
| 125 const cc::LayerList& children = layer->children(); | 125 const cc::LayerList& children = layer->children(); |
| 126 for (size_t i = 0; i < children.size(); ++i) { | 126 for (size_t i = 0; i < children.size(); ++i) { |
| 127 Serialize(children[i].get()); | 127 Serialize(children[i].get()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 skia::RefPtr<SkPicture> picture = layer->GetPicture(); | 130 sk_sp<SkPicture> picture = layer->GetPicture(); |
| 131 if (!picture) | 131 if (!picture) |
| 132 return; | 132 return; |
| 133 | 133 |
| 134 // Serialize picture to file. | 134 // Serialize picture to file. |
| 135 // TODO(alokp): Note that for this to work Chrome needs to be launched with | 135 // TODO(alokp): Note that for this to work Chrome needs to be launched with |
| 136 // --no-sandbox command-line flag. Get rid of this limitation. | 136 // --no-sandbox command-line flag. Get rid of this limitation. |
| 137 // CRBUG: 139640. | 137 // CRBUG: 139640. |
| 138 std::string filename = "layer_" + base::IntToString(layer_id_++) + ".skp"; | 138 std::string filename = "layer_" + base::IntToString(layer_id_++) + ".skp"; |
| 139 std::string filepath = dirpath_.AppendASCII(filename).MaybeAsASCII(); | 139 std::string filepath = dirpath_.AppendASCII(filename).MaybeAsASCII(); |
| 140 DCHECK(!filepath.empty()); | 140 DCHECK(!filepath.empty()); |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 bool GpuBenchmarking::HasGpuProcess() { | 910 bool GpuBenchmarking::HasGpuProcess() { |
| 911 bool has_gpu_process = false; | 911 bool has_gpu_process = false; |
| 912 if (!RenderThreadImpl::current()->Send( | 912 if (!RenderThreadImpl::current()->Send( |
| 913 new ChildProcessHostMsg_HasGpuProcess(&has_gpu_process))) | 913 new ChildProcessHostMsg_HasGpuProcess(&has_gpu_process))) |
| 914 return false; | 914 return false; |
| 915 | 915 |
| 916 return has_gpu_process; | 916 return has_gpu_process; |
| 917 } | 917 } |
| 918 | 918 |
| 919 } // namespace content | 919 } // namespace content |
| OLD | NEW |