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

Side by Side Diff: ash/touch/touch_hud_debug.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/touch/touch_hud_debug.h" 5 #include "ash/touch/touch_hud_debug.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 bool active() const { 154 bool active() const {
155 return !log_.empty() && log_.back().type != ui::ET_TOUCH_RELEASED && 155 return !log_.empty() && log_.back().type != ui::ET_TOUCH_RELEASED &&
156 log_.back().type != ui::ET_TOUCH_CANCELLED; 156 log_.back().type != ui::ET_TOUCH_CANCELLED;
157 } 157 }
158 158
159 // Returns a list containing data from all events for the touch point. 159 // Returns a list containing data from all events for the touch point.
160 std::unique_ptr<base::ListValue> GetAsList() const { 160 std::unique_ptr<base::ListValue> GetAsList() const {
161 std::unique_ptr<base::ListValue> list(new base::ListValue()); 161 std::unique_ptr<base::ListValue> list(new base::ListValue());
162 for (const_iterator i = log_.begin(); i != log_.end(); ++i) 162 for (const_iterator i = log_.begin(); i != log_.end(); ++i)
163 list->Append((*i).GetAsDictionary().release()); 163 list->Append((*i).GetAsDictionary());
164 return list; 164 return list;
165 } 165 }
166 166
167 void Reset() { 167 void Reset() {
168 log_.clear(); 168 log_.clear();
169 } 169 }
170 170
171 private: 171 private:
172 std::vector<TouchPointLog> log_; 172 std::vector<TouchPointLog> log_;
173 173
(...skipping 15 matching lines...) Expand all
189 void Reset() { 189 void Reset() {
190 next_trace_index_ = 0; 190 next_trace_index_ = 0;
191 for (int i = 0; i < kMaxPaths; ++i) 191 for (int i = 0; i < kMaxPaths; ++i)
192 traces_[i].Reset(); 192 traces_[i].Reset();
193 } 193 }
194 194
195 std::unique_ptr<base::ListValue> GetAsList() const { 195 std::unique_ptr<base::ListValue> GetAsList() const {
196 std::unique_ptr<base::ListValue> list(new base::ListValue()); 196 std::unique_ptr<base::ListValue> list(new base::ListValue());
197 for (int i = 0; i < kMaxPaths; ++i) { 197 for (int i = 0; i < kMaxPaths; ++i) {
198 if (!traces_[i].log().empty()) 198 if (!traces_[i].log().empty())
199 list->Append(traces_[i].GetAsList().release()); 199 list->Append(traces_[i].GetAsList());
200 } 200 }
201 return list; 201 return list;
202 } 202 }
203 203
204 int GetTraceIndex(int touch_id) const { 204 int GetTraceIndex(int touch_id) const {
205 return touch_id_to_trace_index_.at(touch_id); 205 return touch_id_to_trace_index_.at(touch_id);
206 } 206 }
207 207
208 const TouchTrace* traces() const { 208 const TouchTrace* traces() const {
209 return traces_; 209 return traces_;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 RootWindowController* controller) { 473 RootWindowController* controller) {
474 controller->set_touch_hud_debug(this); 474 controller->set_touch_hud_debug(this);
475 } 475 }
476 476
477 void TouchHudDebug::UnsetHudForRootWindowController( 477 void TouchHudDebug::UnsetHudForRootWindowController(
478 RootWindowController* controller) { 478 RootWindowController* controller) {
479 controller->set_touch_hud_debug(NULL); 479 controller->set_touch_hud_debug(NULL);
480 } 480 }
481 481
482 } // namespace ash 482 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/trace_event_unittest.cc » ('j') | extensions/browser/api/declarative/rules_registry.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698