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> |
11 | 11 |
12 #include "base/base64.h" | 12 #include "base/base64.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "cc/layers/layer.h" | 19 #include "cc/layers/layer.h" |
20 #include "cc/trees/layer_tree_host.h" | |
21 #include "content/common/child_process_messages.h" | 20 #include "content/common/child_process_messages.h" |
22 #include "content/common/input/synthetic_gesture_params.h" | 21 #include "content/common/input/synthetic_gesture_params.h" |
23 #include "content/common/input/synthetic_pinch_gesture_params.h" | 22 #include "content/common/input/synthetic_pinch_gesture_params.h" |
24 #include "content/common/input/synthetic_smooth_drag_gesture_params.h" | 23 #include "content/common/input/synthetic_smooth_drag_gesture_params.h" |
25 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" | 24 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" |
26 #include "content/common/input/synthetic_tap_gesture_params.h" | 25 #include "content/common/input/synthetic_tap_gesture_params.h" |
27 #include "content/public/child/v8_value_converter.h" | 26 #include "content/public/child/v8_value_converter.h" |
28 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
29 #include "content/public/renderer/chrome_object_extensions_utils.h" | 28 #include "content/public/renderer/chrome_object_extensions_utils.h" |
30 #include "content/public/renderer/render_thread.h" | 29 #include "content/public/renderer/render_thread.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 layer_id_(0) { | 118 layer_id_(0) { |
120 // Let skia register known effect subclasses. This basically enables | 119 // Let skia register known effect subclasses. This basically enables |
121 // reflection on those subclasses required for picture serialization. | 120 // reflection on those subclasses required for picture serialization. |
122 SkiaBenchmarking::Initialize(); | 121 SkiaBenchmarking::Initialize(); |
123 } | 122 } |
124 | 123 |
125 // Recursively serializes the layer tree. | 124 // Recursively serializes the layer tree. |
126 // Each layer in the tree is serialized into a separate skp file | 125 // Each layer in the tree is serialized into a separate skp file |
127 // in the given directory. | 126 // in the given directory. |
128 void Serialize(const cc::Layer* root_layer) { | 127 void Serialize(const cc::Layer* root_layer) { |
129 for (auto* layer : *root_layer->layer_tree_host()) { | 128 for (auto* layer : *root_layer->GetLayerTree()) { |
130 sk_sp<SkPicture> picture = layer->GetPicture(); | 129 sk_sp<SkPicture> picture = layer->GetPicture(); |
131 if (!picture) | 130 if (!picture) |
132 continue; | 131 continue; |
133 | 132 |
134 // Serialize picture to file. | 133 // Serialize picture to file. |
135 // TODO(alokp): Note that for this to work Chrome needs to be launched | 134 // TODO(alokp): Note that for this to work Chrome needs to be launched |
136 // with | 135 // with |
137 // --no-sandbox command-line flag. Get rid of this limitation. | 136 // --no-sandbox command-line flag. Get rid of this limitation. |
138 // CRBUG: 139640. | 137 // CRBUG: 139640. |
139 std::string filename = "layer_" + base::IntToString(layer_id_++) + ".skp"; | 138 std::string filename = "layer_" + base::IntToString(layer_id_++) + ".skp"; |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 &gpu_driver_bug_workarounds))) { | 960 &gpu_driver_bug_workarounds))) { |
962 return; | 961 return; |
963 } | 962 } |
964 | 963 |
965 v8::Local<v8::Value> result; | 964 v8::Local<v8::Value> result; |
966 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) | 965 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) |
967 args->Return(result); | 966 args->Return(result); |
968 } | 967 } |
969 | 968 |
970 } // namespace content | 969 } // namespace content |
OLD | NEW |