OLD | NEW |
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 #if defined(USE_X11) | 5 #if defined(USE_X11) |
6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
7 #endif | 7 #endif |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 private: | 135 private: |
136 TimeTicks start_time_; | 136 TimeTicks start_time_; |
137 int frames_; | 137 int frames_; |
138 int max_frames_; | 138 int max_frames_; |
139 | 139 |
140 DISALLOW_COPY_AND_ASSIGN(BenchCompositorObserver); | 140 DISALLOW_COPY_AND_ASSIGN(BenchCompositorObserver); |
141 }; | 141 }; |
142 | 142 |
143 void ReturnMailbox(scoped_refptr<cc::ContextProvider> context_provider, | 143 void ReturnMailbox(scoped_refptr<cc::ContextProvider> context_provider, |
144 GLuint texture, | 144 GLuint texture, |
145 GLuint sync_point, | 145 const gpu::SyncToken& sync_token, |
146 bool is_lost) { | 146 bool is_lost) { |
147 gpu::gles2::GLES2Interface* gl = context_provider->ContextGL(); | 147 gpu::gles2::GLES2Interface* gl = context_provider->ContextGL(); |
148 gl->WaitSyncPointCHROMIUM(sync_point); | 148 gl->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); |
149 gl->DeleteTextures(1, &texture); | 149 gl->DeleteTextures(1, &texture); |
150 gl->ShallowFlushCHROMIUM(); | 150 gl->ShallowFlushCHROMIUM(); |
151 } | 151 } |
152 | 152 |
153 gfx::Size GetFullscreenSize() { | 153 gfx::Size GetFullscreenSize() { |
154 #if defined(OS_WIN) | 154 #if defined(OS_WIN) |
155 return gfx::Size(GetSystemMetrics(SM_CXSCREEN), | 155 return gfx::Size(GetSystemMetrics(SM_CXSCREEN), |
156 GetSystemMetrics(SM_CYSCREEN)); | 156 GetSystemMetrics(SM_CYSCREEN)); |
157 #else | 157 #else |
158 NOTIMPLEMENTED(); | 158 NOTIMPLEMENTED(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 gl->GenFramebuffers(1, &fbo_); | 220 gl->GenFramebuffers(1, &fbo_); |
221 gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_); | 221 gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_); |
222 gl->FramebufferTexture2D( | 222 gl->FramebufferTexture2D( |
223 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); | 223 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); |
224 gl->ClearColor(0.f, 1.f, 0.f, 1.f); | 224 gl->ClearColor(0.f, 1.f, 0.f, 1.f); |
225 gl->Clear(GL_COLOR_BUFFER_BIT); | 225 gl->Clear(GL_COLOR_BUFFER_BIT); |
226 gl->Flush(); | 226 gl->Flush(); |
227 | 227 |
228 GLuint sync_point = gl->InsertSyncPointCHROMIUM(); | 228 GLuint sync_point = gl->InsertSyncPointCHROMIUM(); |
229 webgl_.SetTextureMailbox( | 229 webgl_.SetTextureMailbox( |
230 cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), | 230 cc::TextureMailbox(mailbox, gpu::SyncToken(sync_point), GL_TEXTURE_2D), |
231 cc::SingleReleaseCallback::Create( | 231 cc::SingleReleaseCallback::Create( |
232 base::Bind(ReturnMailbox, context_provider_, texture)), | 232 base::Bind(ReturnMailbox, context_provider_, texture)), |
233 bounds.size()); | 233 bounds.size()); |
234 compositor->AddObserver(this); | 234 compositor->AddObserver(this); |
235 } | 235 } |
236 | 236 |
237 ~WebGLBench() override { | 237 ~WebGLBench() override { |
238 webgl_.SetShowSolidColorContent(); | 238 webgl_.SetShowSolidColorContent(); |
239 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); | 239 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); |
240 gl->DeleteFramebuffers(1, &fbo_); | 240 gl->DeleteFramebuffers(1, &fbo_); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 ui::PrintLayerHierarchy(host->window()->layer(), gfx::Point(100, 100)); | 375 ui::PrintLayerHierarchy(host->window()->layer(), gfx::Point(100, 100)); |
376 #endif | 376 #endif |
377 | 377 |
378 host->Show(); | 378 host->Show(); |
379 base::MessageLoopForUI::current()->Run(); | 379 base::MessageLoopForUI::current()->Run(); |
380 focus_client.reset(); | 380 focus_client.reset(); |
381 host.reset(); | 381 host.reset(); |
382 | 382 |
383 return 0; | 383 return 0; |
384 } | 384 } |
OLD | NEW |