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

Side by Side Diff: gpu/tools/compositor_model_bench/compositor_model_bench.cc

Issue 14273038: gpu: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « gpu/gles2_conform_support/native/main.cc ('k') | no next file » | 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 // This tool is used to benchmark the render model used by the compositor 5 // This tool is used to benchmark the render model used by the compositor
6 6
7 // Most of this file is derived from the source of the tile_render_bench tool, 7 // Most of this file is derived from the source of the tile_render_bench tool,
8 // and has been changed to support running a sequence of independent 8 // and has been changed to support running a sequence of independent
9 // simulations for our different render models and test cases. 9 // simulations for our different render models and test cases.
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // sims_remaining_.push(spec); 106 // sims_remaining_.push(spec);
107 } 107 }
108 108
109 void Run() { 109 void Run() {
110 if (!sims_remaining_.size()) { 110 if (!sims_remaining_.size()) {
111 LOG(WARNING) << "No configuration files loaded."; 111 LOG(WARNING) << "No configuration files loaded.";
112 return; 112 return;
113 } 113 }
114 114
115 base::AtExitManager at_exit; 115 base::AtExitManager at_exit;
116 MessageLoop loop; 116 base::MessageLoop loop;
117 if (!InitX11() || !InitGLContext()) { 117 if (!InitX11() || !InitGLContext()) {
118 LOG(FATAL) << "Failed to set up GUI."; 118 LOG(FATAL) << "Failed to set up GUI.";
119 } 119 }
120 120
121 InitBuffers(); 121 InitBuffers();
122 122
123 LOG(INFO) << "Running " << sims_remaining_.size() << " simulations."; 123 LOG(INFO) << "Running " << sims_remaining_.size() << " simulations.";
124 124
125 loop.PostTask(FROM_HERE, 125 loop.PostTask(FROM_HERE,
126 base::Bind(&Simulator::ProcessEvents, 126 base::Bind(&Simulator::ProcessEvents,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 glXSwapBuffers(display_, window_); 260 glXSwapBuffers(display_, window_);
261 261
262 XExposeEvent ev = { Expose, 0, 1, display_, window_, 262 XExposeEvent ev = { Expose, 0, 1, display_, window_,
263 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0 }; 263 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0 };
264 XSendEvent(display_, 264 XSendEvent(display_,
265 window_, 265 window_,
266 False, 266 False,
267 ExposureMask, 267 ExposureMask,
268 reinterpret_cast<XEvent*>(&ev)); 268 reinterpret_cast<XEvent*>(&ev));
269 269
270 MessageLoop::current()->PostTask( 270 base::MessageLoop::current()->PostTask(
271 FROM_HERE, 271 FROM_HERE,
272 base::Bind(&Simulator::UpdateLoop, weak_factory_.GetWeakPtr())); 272 base::Bind(&Simulator::UpdateLoop, weak_factory_.GetWeakPtr()));
273 } 273 }
274 274
275 void DumpOutput() { 275 void DumpOutput() {
276 LOG(INFO) << "Successfully ran " << sims_completed_.size() << " tests"; 276 LOG(INFO) << "Successfully ran " << sims_completed_.size() << " tests";
277 277
278 FILE* f = OpenFile(output_path_, "w"); 278 FILE* f = OpenFile(output_path_, "w");
279 279
280 if (!f) { 280 if (!f) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 while (sims_remaining_.size() && !InitializeNextTest()) { 318 while (sims_remaining_.size() && !InitializeNextTest()) {
319 sims_remaining_.pop(); 319 sims_remaining_.pop();
320 } 320 }
321 if (sims_remaining_.size()) { 321 if (sims_remaining_.size()) {
322 sims_remaining_.front().simulation_start_time = TimeTicks::Now(); 322 sims_remaining_.front().simulation_start_time = TimeTicks::Now();
323 } 323 }
324 } 324 }
325 325
326 if (!sims_remaining_.size()) { 326 if (!sims_remaining_.size()) {
327 DumpOutput(); 327 DumpOutput();
328 MessageLoop::current()->Quit(); 328 base::MessageLoop::current()->Quit();
329 return false; 329 return false;
330 } 330 }
331 331
332 return true; 332 return true;
333 } 333 }
334 334
335 void Resize(int width, int height) { 335 void Resize(int width, int height) {
336 window_width_ = width; 336 window_width_ = width;
337 window_height_ = height; 337 window_height_ = height;
338 if (current_sim_) 338 if (current_sim_)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 } else { 396 } else {
397 LOG(INFO) << "(input path is a file)"; 397 LOG(INFO) << "(input path is a file)";
398 sim.QueueTest(inPath); 398 sim.QueueTest(inPath);
399 } 399 }
400 400
401 sim.Run(); 401 sim.Run();
402 402
403 return 0; 403 return 0;
404 } 404 }
OLDNEW
« no previous file with comments | « gpu/gles2_conform_support/native/main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698