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

Side by Side Diff: cc/debug/invalidation_benchmark.cc

Issue 1129083003: More base::Values-related bare pointer -> scoped_ptr conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad merge Created 5 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/debug/invalidation_benchmark.h" 5 #include "cc/debug/invalidation_benchmark.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 bool InvalidationBenchmark::ProcessMessage(scoped_ptr<base::Value> value) { 109 bool InvalidationBenchmark::ProcessMessage(scoped_ptr<base::Value> value) {
110 base::DictionaryValue* message = nullptr; 110 base::DictionaryValue* message = nullptr;
111 value->GetAsDictionary(&message); 111 value->GetAsDictionary(&message);
112 if (!message) 112 if (!message)
113 return false; 113 return false;
114 114
115 bool notify_done; 115 bool notify_done;
116 if (message->HasKey("notify_done")) { 116 if (message->HasKey("notify_done")) {
117 message->GetBoolean("notify_done", &notify_done); 117 message->GetBoolean("notify_done", &notify_done);
118 if (notify_done) 118 if (notify_done)
119 NotifyDone(scoped_ptr<base::Value>(base::Value::CreateNullValue())); 119 NotifyDone(base::Value::CreateNullValue());
120 return true; 120 return true;
121 } 121 }
122 return false; 122 return false;
123 } 123 }
124 124
125 // A simple linear congruential generator. The random numbers don't need to be 125 // A simple linear congruential generator. The random numbers don't need to be
126 // high quality, but they need to be identical in each run. Therefore, we use a 126 // high quality, but they need to be identical in each run. Therefore, we use a
127 // LCG and keep the state locally in the benchmark. 127 // LCG and keep the state locally in the benchmark.
128 float InvalidationBenchmark::LCGRandom() { 128 float InvalidationBenchmark::LCGRandom() {
129 const uint32 a = 1664525; 129 const uint32 a = 1664525;
130 const uint32 c = 1013904223; 130 const uint32 c = 1013904223;
131 seed_ = a * seed_ + c; 131 seed_ = a * seed_ + c;
132 return static_cast<float>(seed_) / std::numeric_limits<uint32>::max(); 132 return static_cast<float>(seed_) / std::numeric_limits<uint32>::max();
133 } 133 }
134 134
135 } // namespace cc 135 } // namespace cc
OLDNEW
« no previous file with comments | « base/values_unittest.cc ('k') | chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698