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

Unified Diff: content/renderer/gpu/gpu_benchmarking_extension.cc

Issue 1921503005: cc: Move main thread hierarchy dependencies into PropertyTreeBuilder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/property_tree_builder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/gpu_benchmarking_extension.cc
diff --git a/content/renderer/gpu/gpu_benchmarking_extension.cc b/content/renderer/gpu/gpu_benchmarking_extension.cc
index 4a54057196e7c36204eaccc57e229db423708cbf..8fe5bae7d4889f1e6ea25c7f664b61aeae027afc 100644
--- a/content/renderer/gpu/gpu_benchmarking_extension.cc
+++ b/content/renderer/gpu/gpu_benchmarking_extension.cc
@@ -17,6 +17,7 @@
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "cc/layers/layer.h"
+#include "cc/trees/layer_tree_host.h"
#include "content/common/child_process_messages.h"
#include "content/common/input/synthetic_gesture_params.h"
#include "content/common/input/synthetic_pinch_gesture_params.h"
@@ -124,29 +125,27 @@ class SkPictureSerializer {
// Recursively serializes the layer tree.
// Each layer in the tree is serialized into a separate skp file
// in the given directory.
- void Serialize(const cc::Layer* layer) {
- const cc::LayerList& children = layer->children();
- for (size_t i = 0; i < children.size(); ++i) {
- Serialize(children[i].get());
+ void Serialize(const cc::Layer* root_layer) {
+ for (auto* layer : *root_layer->layer_tree_host()) {
+ sk_sp<SkPicture> picture = layer->GetPicture();
+ if (!picture)
+ continue;
+
+ // Serialize picture to file.
+ // TODO(alokp): Note that for this to work Chrome needs to be launched
+ // with
+ // --no-sandbox command-line flag. Get rid of this limitation.
+ // CRBUG: 139640.
+ std::string filename = "layer_" + base::IntToString(layer_id_++) + ".skp";
+ std::string filepath = dirpath_.AppendASCII(filename).MaybeAsASCII();
+ DCHECK(!filepath.empty());
+ SkFILEWStream file(filepath.c_str());
+ DCHECK(file.isValid());
+
+ EncodingSerializer serializer;
+ picture->serialize(&file, &serializer);
+ file.fsync();
}
-
- sk_sp<SkPicture> picture = layer->GetPicture();
- if (!picture)
- return;
-
- // Serialize picture to file.
- // TODO(alokp): Note that for this to work Chrome needs to be launched with
- // --no-sandbox command-line flag. Get rid of this limitation.
- // CRBUG: 139640.
- std::string filename = "layer_" + base::IntToString(layer_id_++) + ".skp";
- std::string filepath = dirpath_.AppendASCII(filename).MaybeAsASCII();
- DCHECK(!filepath.empty());
- SkFILEWStream file(filepath.c_str());
- DCHECK(file.isValid());
-
- EncodingSerializer serializer;
- picture->serialize(&file, &serializer);
- file.fsync();
}
private:
« no previous file with comments | « cc/trees/property_tree_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698