OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 }; | 54 }; |
55 | 55 |
56 // Forward declarations | 56 // Forward declarations |
57 class Simulator; | 57 class Simulator; |
58 void _process_events(Simulator* sim); | 58 void _process_events(Simulator* sim); |
59 void _update_loop(Simulator* sim); | 59 void _update_loop(Simulator* sim); |
60 | 60 |
61 class Simulator { | 61 class Simulator { |
62 public: | 62 public: |
63 Simulator(int seconds_per_test, const FilePath& output_path) | 63 Simulator(int seconds_per_test, const FilePath& output_path) |
64 : running_(false), | 64 : current_sim_(NULL), |
65 current_sim_(NULL), | |
66 output_path_(output_path), | 65 output_path_(output_path), |
67 seconds_per_test_(seconds_per_test), | 66 seconds_per_test_(seconds_per_test), |
68 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 67 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
69 display_(NULL), | 68 display_(NULL), |
70 window_(0), | 69 window_(0), |
71 gl_context_(NULL), | 70 gl_context_(NULL), |
72 window_width_(WINDOW_WIDTH), | 71 window_width_(WINDOW_WIDTH), |
73 window_height_(WINDOW_HEIGHT) { | 72 window_height_(WINDOW_HEIGHT) { |
74 } | 73 } |
75 | 74 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 333 } |
335 | 334 |
336 void Resize(int width, int height) { | 335 void Resize(int width, int height) { |
337 window_width_ = width; | 336 window_width_ = width; |
338 window_height_ = height; | 337 window_height_ = height; |
339 if (current_sim_) | 338 if (current_sim_) |
340 current_sim_->Resize(window_width_, window_height_); | 339 current_sim_->Resize(window_width_, window_height_); |
341 } | 340 } |
342 | 341 |
343 // Simulation task list for this execution | 342 // Simulation task list for this execution |
344 bool running_; | |
345 RenderModelSimulator* current_sim_; | 343 RenderModelSimulator* current_sim_; |
346 queue<SimulationSpecification> sims_remaining_; | 344 queue<SimulationSpecification> sims_remaining_; |
347 queue<SimulationSpecification> sims_completed_; | 345 queue<SimulationSpecification> sims_completed_; |
348 FilePath output_path_; | 346 FilePath output_path_; |
349 // Amount of time to run each simulation | 347 // Amount of time to run each simulation |
350 int seconds_per_test_; | 348 int seconds_per_test_; |
351 // GUI data | 349 // GUI data |
352 base::WeakPtrFactory<Simulator> weak_factory_; | 350 base::WeakPtrFactory<Simulator> weak_factory_; |
353 Display* display_; | 351 Display* display_; |
354 Window window_; | 352 Window window_; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 395 } |
398 } else { | 396 } else { |
399 LOG(INFO) << "(input path is a file)"; | 397 LOG(INFO) << "(input path is a file)"; |
400 sim.QueueTest(inPath); | 398 sim.QueueTest(inPath); |
401 } | 399 } |
402 | 400 |
403 sim.Run(); | 401 sim.Run(); |
404 | 402 |
405 return 0; | 403 return 0; |
406 } | 404 } |
OLD | NEW |