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

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

Issue 1129903002: gpu: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Really rebase. 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 (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 10 matching lines...) Expand all
21 #include <string> 21 #include <string>
22 #include <vector> 22 #include <vector>
23 23
24 #include "base/at_exit.h" 24 #include "base/at_exit.h"
25 #include "base/basictypes.h" 25 #include "base/basictypes.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/memory/scoped_ptr.h" 32 #include "base/memory/scoped_ptr.h"
32 #include "base/message_loop/message_loop.h" 33 #include "base/single_thread_task_runner.h"
no sievers 2015/05/06 21:51:10 You need to leave this one in to fix the build.
Sami 2015/05/07 10:44:11 Ah, thanks. Done.
34 #include "base/thread_task_runner_handle.h"
33 #include "base/time/time.h" 35 #include "base/time/time.h"
34 #include "gpu/tools/compositor_model_bench/render_model_utils.h" 36 #include "gpu/tools/compositor_model_bench/render_model_utils.h"
35 #include "gpu/tools/compositor_model_bench/render_models.h" 37 #include "gpu/tools/compositor_model_bench/render_models.h"
36 #include "gpu/tools/compositor_model_bench/render_tree.h" 38 #include "gpu/tools/compositor_model_bench/render_tree.h"
37 #include "ui/gl/gl_surface.h" 39 #include "ui/gl/gl_surface.h"
38 40
39 using base::TimeTicks; 41 using base::TimeTicks;
40 using base::DirectoryExists; 42 using base::DirectoryExists;
41 using base::PathExists; 43 using base::PathExists;
42 using std::queue; 44 using std::queue;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 base::AtExitManager at_exit; 114 base::AtExitManager at_exit;
113 base::MessageLoop loop; 115 base::MessageLoop loop;
114 if (!InitX11() || !InitGLContext()) { 116 if (!InitX11() || !InitGLContext()) {
115 LOG(FATAL) << "Failed to set up GUI."; 117 LOG(FATAL) << "Failed to set up GUI.";
116 } 118 }
117 119
118 InitBuffers(); 120 InitBuffers();
119 121
120 LOG(INFO) << "Running " << sims_remaining_.size() << " simulations."; 122 LOG(INFO) << "Running " << sims_remaining_.size() << " simulations.";
121 123
122 loop.PostTask(FROM_HERE, 124 loop.task_runner()->PostTask(
123 base::Bind(&Simulator::ProcessEvents, 125 FROM_HERE,
124 weak_factory_.GetWeakPtr())); 126 base::Bind(&Simulator::ProcessEvents, weak_factory_.GetWeakPtr()));
125 loop.Run(); 127 loop.Run();
126 } 128 }
127 129
128 void ProcessEvents() { 130 void ProcessEvents() {
129 // Consume all the X events. 131 // Consume all the X events.
130 while (XPending(display_)) { 132 while (XPending(display_)) {
131 XEvent e; 133 XEvent e;
132 XNextEvent(display_, &e); 134 XNextEvent(display_, &e);
133 switch (e.type) { 135 switch (e.type) {
134 case Expose: 136 case Expose:
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 glXSwapBuffers(display_, window_); 259 glXSwapBuffers(display_, window_);
258 260
259 XExposeEvent ev = { Expose, 0, 1, display_, window_, 261 XExposeEvent ev = { Expose, 0, 1, display_, window_,
260 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0 }; 262 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0 };
261 XSendEvent(display_, 263 XSendEvent(display_,
262 window_, 264 window_,
263 False, 265 False,
264 ExposureMask, 266 ExposureMask,
265 reinterpret_cast<XEvent*>(&ev)); 267 reinterpret_cast<XEvent*>(&ev));
266 268
267 base::MessageLoop::current()->PostTask( 269 base::ThreadTaskRunnerHandle::Get()->PostTask(
268 FROM_HERE, 270 FROM_HERE,
269 base::Bind(&Simulator::UpdateLoop, weak_factory_.GetWeakPtr())); 271 base::Bind(&Simulator::UpdateLoop, weak_factory_.GetWeakPtr()));
270 } 272 }
271 273
272 void DumpOutput() { 274 void DumpOutput() {
273 LOG(INFO) << "Successfully ran " << sims_completed_.size() << " tests"; 275 LOG(INFO) << "Successfully ran " << sims_completed_.size() << " tests";
274 276
275 FILE* f = base::OpenFile(output_path_, "w"); 277 FILE* f = base::OpenFile(output_path_, "w");
276 278
277 if (!f) { 279 if (!f) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 394 }
393 } else { 395 } else {
394 LOG(INFO) << "(input path is a file)"; 396 LOG(INFO) << "(input path is a file)";
395 sim.QueueTest(inPath); 397 sim.QueueTest(inPath);
396 } 398 }
397 399
398 sim.Run(); 400 sim.Run();
399 401
400 return 0; 402 return 0;
401 } 403 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698