| 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 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // Let skia register known effect subclasses. This basically enables | 132 // Let skia register known effect subclasses. This basically enables |
| 133 // reflection on those subclasses required for picture serialization. | 133 // reflection on those subclasses required for picture serialization. |
| 134 SkiaBenchmarking::Initialize(); | 134 SkiaBenchmarking::Initialize(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 // Recursively serializes the layer tree. | 137 // Recursively serializes the layer tree. |
| 138 // Each layer in the tree is serialized into a separate skp file | 138 // Each layer in the tree is serialized into a separate skp file |
| 139 // in the given directory. | 139 // in the given directory. |
| 140 void Serialize(const cc::Layer* root_layer) { | 140 void Serialize(const cc::Layer* root_layer) { |
| 141 for (auto* layer : *root_layer->layer_tree_host()) { | 141 for (auto* layer : *root_layer->layer_tree_host()) { |
| 142 sk_sp<SkPicture> picture = cc::ToSkPicture(layer->GetPicture()); | 142 sk_sp<SkPicture> picture = layer->GetPicture(); |
| 143 if (!picture) | 143 if (!picture) |
| 144 continue; | 144 continue; |
| 145 | 145 |
| 146 // Serialize picture to file. | 146 // Serialize picture to file. |
| 147 // TODO(alokp): Note that for this to work Chrome needs to be launched | 147 // TODO(alokp): Note that for this to work Chrome needs to be launched |
| 148 // with | 148 // with |
| 149 // --no-sandbox command-line flag. Get rid of this limitation. | 149 // --no-sandbox command-line flag. Get rid of this limitation. |
| 150 // CRBUG: 139640. | 150 // CRBUG: 139640. |
| 151 std::string filename = "layer_" + base::IntToString(layer_id_++) + ".skp"; | 151 std::string filename = "layer_" + base::IntToString(layer_id_++) + ".skp"; |
| 152 std::string filepath = dirpath_.AppendASCII(filename).MaybeAsASCII(); | 152 std::string filepath = dirpath_.AppendASCII(filename).MaybeAsASCII(); |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 &gpu_driver_bug_workarounds))) { | 1100 &gpu_driver_bug_workarounds))) { |
| 1101 return; | 1101 return; |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 v8::Local<v8::Value> result; | 1104 v8::Local<v8::Value> result; |
| 1105 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) | 1105 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) |
| 1106 args->Return(result); | 1106 args->Return(result); |
| 1107 } | 1107 } |
| 1108 | 1108 |
| 1109 } // namespace content | 1109 } // namespace content |
| OLD | NEW |