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

Side by Side Diff: ui/compositor/layer.cc

Issue 2467953003: LayerDebugInfo should not clobber trace output (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 return true; 907 return true;
908 } 908 }
909 909
910 class LayerDebugInfo : public base::trace_event::ConvertableToTraceFormat { 910 class LayerDebugInfo : public base::trace_event::ConvertableToTraceFormat {
911 public: 911 public:
912 explicit LayerDebugInfo(const std::string& name) : name_(name) {} 912 explicit LayerDebugInfo(const std::string& name) : name_(name) {}
913 ~LayerDebugInfo() override {} 913 ~LayerDebugInfo() override {}
914 void AppendAsTraceFormat(std::string* out) const override { 914 void AppendAsTraceFormat(std::string* out) const override {
915 base::DictionaryValue dictionary; 915 base::DictionaryValue dictionary;
916 dictionary.SetString("layer_name", name_); 916 dictionary.SetString("layer_name", name_);
917 base::JSONWriter::Write(dictionary, out); 917 std::string tmp;
918 base::JSONWriter::Write(dictionary, &tmp);
919 out->append(tmp);
918 } 920 }
919 921
920 private: 922 private:
921 std::string name_; 923 std::string name_;
922 }; 924 };
923 925
924 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> 926 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
925 Layer::TakeDebugInfo(cc::Layer* layer) { 927 Layer::TakeDebugInfo(cc::Layer* layer) {
926 return base::WrapUnique(new LayerDebugInfo(name_)); 928 return base::WrapUnique(new LayerDebugInfo(name_));
927 } 929 }
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(), 1175 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(),
1174 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { 1176 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) {
1175 return mirror_ptr.get() == mirror; 1177 return mirror_ptr.get() == mirror;
1176 }); 1178 });
1177 1179
1178 DCHECK(it != mirrors_.end()); 1180 DCHECK(it != mirrors_.end());
1179 mirrors_.erase(it); 1181 mirrors_.erase(it);
1180 } 1182 }
1181 1183
1182 } // namespace ui 1184 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698