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

Side by Side Diff: ui/aura/bench/bench_main.cc

Issue 10689108: Aura: Have ui::Layer implement WebKit::WebExternalTextureLayerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nuke TestImageTransportFactory. Created 8 years, 5 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
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 #include "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/i18n/icu_util.h" 8 #include "base/i18n/icu_util.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 const int kFrames = 100; 84 const int kFrames = 100;
85 85
86 // Benchmark base class, hooks up drawing callback and displaying FPS. 86 // Benchmark base class, hooks up drawing callback and displaying FPS.
87 class BenchCompositorObserver : public ui::CompositorObserver { 87 class BenchCompositorObserver : public ui::CompositorObserver {
88 public: 88 public:
89 explicit BenchCompositorObserver(int max_frames) 89 explicit BenchCompositorObserver(int max_frames)
90 : start_time_(), 90 : start_time_(),
91 frames_(0), 91 frames_(0),
92 max_frames_(max_frames) { 92 max_frames_(max_frames) {
93 } 93 }
94
95 virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE {}
96
94 virtual void OnCompositingWillStart(Compositor* compositor) OVERRIDE {} 97 virtual void OnCompositingWillStart(Compositor* compositor) OVERRIDE {}
95 98
96 virtual void OnCompositingStarted(Compositor* compositor) OVERRIDE {} 99 virtual void OnCompositingStarted(Compositor* compositor) OVERRIDE {}
97 100
98 virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE { 101 virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE {
99 if (start_time_.is_null()) { 102 if (start_time_.is_null()) {
100 start_time_ = TimeTicks::Now(); 103 start_time_ = TimeTicks::Now();
101 } else { 104 } else {
102 ++frames_; 105 ++frames_;
103 if (frames_ % kFrames == 0) { 106 if (frames_ % kFrames == 0) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 context_->bindTexture(GL_TEXTURE_2D, texture_id()); 140 context_->bindTexture(GL_TEXTURE_2D, texture_id());
138 context_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 141 context_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
139 context_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 142 context_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
140 context_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 143 context_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
141 context_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 144 context_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
142 context_->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 145 context_->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
143 size.width(), size.height(), 0, 146 size.width(), size.height(), 0,
144 GL_RGBA, GL_UNSIGNED_BYTE, NULL); 147 GL_RGBA, GL_UNSIGNED_BYTE, NULL);
145 } 148 }
146 149
150 virtual WebGraphicsContext3D* HostContext3D() OVERRIDE {
151 return context_;
152 }
153
147 private: 154 private:
148 virtual ~WebGLTexture() { 155 virtual ~WebGLTexture() {
149 context_->deleteTexture(texture_id()); 156 context_->deleteTexture(texture_id());
150 } 157 }
151 158
152 WebGraphicsContext3D* context_; 159 WebGraphicsContext3D* context_;
153 160
154 DISALLOW_COPY_AND_ASSIGN(WebGLTexture); 161 DISALLOW_COPY_AND_ASSIGN(WebGLTexture);
155 }; 162 };
156 163
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 #endif 338 #endif
332 339
333 root_window->ShowRootWindow(); 340 root_window->ShowRootWindow();
334 MessageLoopForUI::current()->Run(); 341 MessageLoopForUI::current()->Run();
335 root_window.reset(); 342 root_window.reset();
336 343
337 ui::CompositorTestSupport::Terminate(); 344 ui::CompositorTestSupport::Terminate();
338 345
339 return 0; 346 return 0;
340 } 347 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698