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

Side by Side Diff: chrome/browser/caps/generate_state_json.cc

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/caps/generate_state_json.h" 5 #include "chrome/browser/caps/generate_state_json.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 int InMBFromB(const TaskManagerModel* model, MemoryFn2 mfn, int index) { 53 int InMBFromB(const TaskManagerModel* model, MemoryFn2 mfn, int index) {
54 size_t result_in_bytes = 0; 54 size_t result_in_bytes = 0;
55 bool ignored; 55 bool ignored;
56 bool res = (model->*mfn)(index, &result_in_bytes, &ignored); 56 bool res = (model->*mfn)(index, &result_in_bytes, &ignored);
57 return res ? InMBFromB(result_in_bytes) : 0; 57 return res ? InMBFromB(result_in_bytes) : 0;
58 } 58 }
59 59
60 class TaskManagerDataDumper : 60 class TaskManagerDataDumper :
61 public base::RefCountedThreadSafe<TaskManagerDataDumper> { 61 public base::RefCountedThreadSafe<TaskManagerDataDumper> {
62 public: 62 public:
63 TaskManagerDataDumper(scoped_refptr<TaskManagerModel> model, 63 TaskManagerDataDumper(scoped_refptr<TaskManagerModel> model, base::File file)
64 base::File file) 64 : model_(model), file_(std::move(file)) {
65 : model_(model), file_(file.Pass()) {
66 model_->RegisterOnDataReadyCallback( 65 model_->RegisterOnDataReadyCallback(
67 base::Bind(&TaskManagerDataDumper::OnDataReady, this)); 66 base::Bind(&TaskManagerDataDumper::OnDataReady, this));
68 model->StartListening(); 67 model->StartListening();
69 // Note that GenerateStateJSON 'new's this object which is reference 68 // Note that GenerateStateJSON 'new's this object which is reference
70 // counted. 69 // counted.
71 AddRef(); 70 AddRef();
72 } 71 }
73 72
74 private: 73 private:
75 friend class base::RefCountedThreadSafe<TaskManagerDataDumper>; 74 friend class base::RefCountedThreadSafe<TaskManagerDataDumper>;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 scoped_refptr<TaskManagerModel> model_; 195 scoped_refptr<TaskManagerModel> model_;
197 base::File file_; 196 base::File file_;
198 }; 197 };
199 198
200 } // namespace 199 } // namespace
201 200
202 namespace caps { 201 namespace caps {
203 202
204 void GenerateStateJSON( 203 void GenerateStateJSON(
205 scoped_refptr<TaskManagerModel> model, base::File file) { 204 scoped_refptr<TaskManagerModel> model, base::File file) {
206 new TaskManagerDataDumper(model, file.Pass()); 205 new TaskManagerDataDumper(model, std::move(file));
207 } 206 }
208 207
209 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698