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

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

Issue 2274213004: Remove calls to deprecated MessageLoop methods from gpu/. (Closed)
Patch Set: manual changes Created 4 years, 3 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
« no previous file with comments | « no previous file | 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 12 matching lines...) Expand all
23 #include <vector> 23 #include <vector>
24 24
25 #include "base/at_exit.h" 25 #include "base/at_exit.h"
26 #include "base/bind.h" 26 #include "base/bind.h"
27 #include "base/command_line.h" 27 #include "base/command_line.h"
28 #include "base/files/file_enumerator.h" 28 #include "base/files/file_enumerator.h"
29 #include "base/files/file_path.h" 29 #include "base/files/file_path.h"
30 #include "base/files/file_util.h" 30 #include "base/files/file_util.h"
31 #include "base/location.h" 31 #include "base/location.h"
32 #include "base/message_loop/message_loop.h" 32 #include "base/message_loop/message_loop.h"
33 #include "base/run_loop.h"
33 #include "base/single_thread_task_runner.h" 34 #include "base/single_thread_task_runner.h"
34 #include "base/threading/thread_task_runner_handle.h" 35 #include "base/threading/thread_task_runner_handle.h"
35 #include "base/time/time.h" 36 #include "base/time/time.h"
36 #include "gpu/tools/compositor_model_bench/render_model_utils.h" 37 #include "gpu/tools/compositor_model_bench/render_model_utils.h"
37 #include "gpu/tools/compositor_model_bench/render_models.h" 38 #include "gpu/tools/compositor_model_bench/render_models.h"
38 #include "gpu/tools/compositor_model_bench/render_tree.h" 39 #include "gpu/tools/compositor_model_bench/render_tree.h"
39 #include "ui/gl/init/gl_factory.h" 40 #include "ui/gl/init/gl_factory.h"
40 41
41 using base::TimeTicks; 42 using base::TimeTicks;
42 using base::DirectoryExists; 43 using base::DirectoryExists;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // sims_remaining_.push(spec); 104 // sims_remaining_.push(spec);
104 } 105 }
105 106
106 void Run() { 107 void Run() {
107 if (sims_remaining_.empty()) { 108 if (sims_remaining_.empty()) {
108 LOG(WARNING) << "No configuration files loaded."; 109 LOG(WARNING) << "No configuration files loaded.";
109 return; 110 return;
110 } 111 }
111 112
112 base::AtExitManager at_exit; 113 base::AtExitManager at_exit;
113 base::MessageLoop loop;
114 if (!InitX11() || !InitGLContext()) { 114 if (!InitX11() || !InitGLContext()) {
115 LOG(FATAL) << "Failed to set up GUI."; 115 LOG(FATAL) << "Failed to set up GUI.";
116 } 116 }
117 117
118 InitBuffers(); 118 InitBuffers();
119 119
120 LOG(INFO) << "Running " << sims_remaining_.size() << " simulations."; 120 LOG(INFO) << "Running " << sims_remaining_.size() << " simulations.";
121 121
122 loop.task_runner()->PostTask( 122 message_loop_.task_runner()->PostTask(
123 FROM_HERE, 123 FROM_HERE,
124 base::Bind(&Simulator::ProcessEvents, weak_factory_.GetWeakPtr())); 124 base::Bind(&Simulator::ProcessEvents, weak_factory_.GetWeakPtr()));
125 loop.Run(); 125 run_loop_.Run();
126 } 126 }
127 127
128 void ProcessEvents() { 128 void ProcessEvents() {
129 // Consume all the X events. 129 // Consume all the X events.
130 while (XPending(display_)) { 130 while (XPending(display_)) {
131 XEvent e; 131 XEvent e;
132 XNextEvent(display_, &e); 132 XNextEvent(display_, &e);
133 switch (e.type) { 133 switch (e.type) {
134 case Expose: 134 case Expose:
135 UpdateLoop(); 135 UpdateLoop();
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 while (sims_remaining_.size() && !InitializeNextTest()) { 309 while (sims_remaining_.size() && !InitializeNextTest()) {
310 sims_remaining_.pop(); 310 sims_remaining_.pop();
311 } 311 }
312 if (sims_remaining_.size()) { 312 if (sims_remaining_.size()) {
313 sims_remaining_.front().simulation_start_time = TimeTicks::Now(); 313 sims_remaining_.front().simulation_start_time = TimeTicks::Now();
314 } 314 }
315 } 315 }
316 316
317 if (sims_remaining_.empty()) { 317 if (sims_remaining_.empty()) {
318 DumpOutput(); 318 DumpOutput();
319 base::MessageLoop::current()->QuitWhenIdle(); 319 run_loop_.QuitWhenIdle();
320 return false; 320 return false;
321 } 321 }
322 322
323 return true; 323 return true;
324 } 324 }
325 325
326 void Resize(int width, int height) { 326 void Resize(int width, int height) {
327 window_width_ = width; 327 window_width_ = width;
328 window_height_ = height; 328 window_height_ = height;
329 if (current_sim_) 329 if (current_sim_)
330 current_sim_->Resize(window_width_, window_height_); 330 current_sim_->Resize(window_width_, window_height_);
331 } 331 }
332 332
333 base::MessageLoop message_loop_;
334 base::RunLoop run_loop_;
335
333 // Simulation task list for this execution 336 // Simulation task list for this execution
334 std::unique_ptr<RenderModelSimulator> current_sim_; 337 std::unique_ptr<RenderModelSimulator> current_sim_;
335 queue<SimulationSpecification> sims_remaining_; 338 queue<SimulationSpecification> sims_remaining_;
336 queue<SimulationSpecification> sims_completed_; 339 queue<SimulationSpecification> sims_completed_;
337 base::FilePath output_path_; 340 base::FilePath output_path_;
338 // Amount of time to run each simulation 341 // Amount of time to run each simulation
339 int seconds_per_test_; 342 int seconds_per_test_;
340 // GUI data 343 // GUI data
341 Display* display_; 344 Display* display_;
342 Window window_; 345 Window window_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 } 389 }
387 } else { 390 } else {
388 LOG(INFO) << "(input path is a file)"; 391 LOG(INFO) << "(input path is a file)";
389 sim.QueueTest(inPath); 392 sim.QueueTest(inPath);
390 } 393 }
391 394
392 sim.Run(); 395 sim.Run();
393 396
394 return 0; 397 return 0;
395 } 398 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698