| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/common/gpu/media/rendering_helper.h" | 5 #include "content/common/gpu/media/rendering_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <numeric> | 8 #include <numeric> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/mac/scoped_nsautorelease_pool.h" | 14 #include "base/mac/scoped_nsautorelease_pool.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/strings/stringize_macros.h" | 16 #include "base/strings/stringize_macros.h" |
| 17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "ui/gl/gl_context.h" | 19 #include "ui/gl/gl_context.h" |
| 20 #include "ui/gl/gl_implementation.h" | 20 #include "ui/gl/gl_implementation.h" |
| 21 #include "ui/gl/gl_surface.h" | 21 #include "ui/gl/gl_surface.h" |
| 22 #include "ui/gl/gl_surface_egl.h" | |
| 23 #include "ui/gl/gl_surface_glx.h" | |
| 24 | 22 |
| 25 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 26 #include <windows.h> | 24 #include <windows.h> |
| 27 #endif | 25 #endif |
| 28 | 26 |
| 29 #if defined(USE_X11) | 27 #if defined(USE_X11) |
| 30 #include "ui/gfx/x/x11_types.h" | 28 #include "ui/gfx/x/x11_types.h" |
| 31 #endif | 29 #endif |
| 32 | 30 |
| 33 #if !defined(OS_WIN) && defined(ARCH_CPU_X86_FAMILY) | 31 #if defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) |
| 32 #include "ui/gl/gl_surface_glx.h" |
| 34 #define GL_VARIANT_GLX 1 | 33 #define GL_VARIANT_GLX 1 |
| 35 #else | 34 #else |
| 35 #include "ui/gl/gl_surface_egl.h" |
| 36 #define GL_VARIANT_EGL 1 | 36 #define GL_VARIANT_EGL 1 |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 #if defined(USE_OZONE) |
| 40 #include "ui/ozone/public/ozone_platform.h" |
| 41 #include "ui/ozone/public/ui_thread_gpu.h" |
| 42 #include "ui/platform_window/platform_window.h" |
| 43 #include "ui/platform_window/platform_window_delegate.h" |
| 44 #endif |
| 45 |
| 39 // Helper for Shader creation. | 46 // Helper for Shader creation. |
| 40 static void CreateShader(GLuint program, | 47 static void CreateShader(GLuint program, |
| 41 GLenum type, | 48 GLenum type, |
| 42 const char* source, | 49 const char* source, |
| 43 int size) { | 50 int size) { |
| 44 GLuint shader = glCreateShader(type); | 51 GLuint shader = glCreateShader(type); |
| 45 glShaderSource(shader, 1, &source, &size); | 52 glShaderSource(shader, 1, &source, &size); |
| 46 glCompileShader(shader); | 53 glCompileShader(shader); |
| 47 int result = GL_FALSE; | 54 int result = GL_FALSE; |
| 48 glGetShaderiv(shader, GL_COMPILE_STATUS, &result); | 55 glGetShaderiv(shader, GL_COMPILE_STATUS, &result); |
| 49 if (!result) { | 56 if (!result) { |
| 50 char log[4096]; | 57 char log[4096]; |
| 51 glGetShaderInfoLog(shader, arraysize(log), NULL, log); | 58 glGetShaderInfoLog(shader, arraysize(log), NULL, log); |
| 52 LOG(FATAL) << log; | 59 LOG(FATAL) << log; |
| 53 } | 60 } |
| 54 glAttachShader(program, shader); | 61 glAttachShader(program, shader); |
| 55 glDeleteShader(shader); | 62 glDeleteShader(shader); |
| 56 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); | 63 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); |
| 57 } | 64 } |
| 58 | 65 |
| 59 namespace content { | 66 namespace content { |
| 60 | 67 |
| 68 #if defined(USE_OZONE) |
| 69 |
| 70 class RenderingHelper::StubOzoneDelegate : public ui::PlatformWindowDelegate { |
| 71 public: |
| 72 StubOzoneDelegate() : widget_(gfx::kNullAcceleratedWidget) { |
| 73 ui_thread_gpu_.Initialize(); |
| 74 platform_window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( |
| 75 this, gfx::Rect()); |
| 76 } |
| 77 virtual ~StubOzoneDelegate() {} |
| 78 |
| 79 virtual void OnBoundsChanged(const gfx::Rect& new_bounds) override {} |
| 80 |
| 81 virtual void OnDamageRect(const gfx::Rect& damaged_region) override {} |
| 82 |
| 83 virtual void DispatchEvent(ui::Event* event) override {} |
| 84 |
| 85 virtual void OnCloseRequest() override {} |
| 86 virtual void OnClosed() override {} |
| 87 |
| 88 virtual void OnWindowStateChanged( |
| 89 ui::PlatformWindowState new_state) override {}; |
| 90 |
| 91 virtual void OnLostCapture() override {}; |
| 92 |
| 93 virtual void OnAcceleratedWidgetAvailable( |
| 94 gfx::AcceleratedWidget widget) override { |
| 95 widget_ = widget; |
| 96 }; |
| 97 |
| 98 virtual void OnActivationChanged(bool active) override {}; |
| 99 |
| 100 gfx::AcceleratedWidget GetAcceleratedWidget() const { return widget_; } |
| 101 |
| 102 gfx::Size GetSize() { return platform_window_->GetBounds().size(); } |
| 103 |
| 104 private: |
| 105 ui::UiThreadGpu ui_thread_gpu_; |
| 106 scoped_ptr<ui::PlatformWindow> platform_window_; |
| 107 gfx::AcceleratedWidget widget_; |
| 108 }; |
| 109 |
| 110 #endif // defined(USE_OZONE) |
| 111 |
| 61 RenderingHelperParams::RenderingHelperParams() | 112 RenderingHelperParams::RenderingHelperParams() |
| 62 : rendering_fps(0), warm_up_iterations(0), render_as_thumbnails(false) { | 113 : rendering_fps(0), warm_up_iterations(0), render_as_thumbnails(false) { |
| 63 } | 114 } |
| 64 | 115 |
| 65 RenderingHelperParams::~RenderingHelperParams() {} | 116 RenderingHelperParams::~RenderingHelperParams() {} |
| 66 | 117 |
| 67 VideoFrameTexture::VideoFrameTexture(uint32 texture_target, | 118 VideoFrameTexture::VideoFrameTexture(uint32 texture_target, |
| 68 uint32 texture_id, | 119 uint32 texture_id, |
| 69 const base::Closure& no_longer_needed_cb) | 120 const base::Closure& no_longer_needed_cb) |
| 70 : texture_target_(texture_target), | 121 : texture_target_(texture_target), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 86 | 137 |
| 87 // static | 138 // static |
| 88 bool RenderingHelper::InitializeOneOff() { | 139 bool RenderingHelper::InitializeOneOff() { |
| 89 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 140 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 90 #if GL_VARIANT_GLX | 141 #if GL_VARIANT_GLX |
| 91 cmd_line->AppendSwitchASCII(switches::kUseGL, | 142 cmd_line->AppendSwitchASCII(switches::kUseGL, |
| 92 gfx::kGLImplementationDesktopName); | 143 gfx::kGLImplementationDesktopName); |
| 93 #else | 144 #else |
| 94 cmd_line->AppendSwitchASCII(switches::kUseGL, gfx::kGLImplementationEGLName); | 145 cmd_line->AppendSwitchASCII(switches::kUseGL, gfx::kGLImplementationEGLName); |
| 95 #endif | 146 #endif |
| 147 |
| 148 #if defined(USE_OZONE) |
| 149 ui::OzonePlatform::InitializeForUI(); |
| 150 #endif |
| 96 return gfx::GLSurface::InitializeOneOff(); | 151 return gfx::GLSurface::InitializeOneOff(); |
| 97 } | 152 } |
| 98 | 153 |
| 99 RenderingHelper::RenderingHelper() { | 154 RenderingHelper::RenderingHelper() { |
| 100 window_ = gfx::kNullAcceleratedWidget; | 155 window_ = gfx::kNullAcceleratedWidget; |
| 101 Clear(); | 156 Clear(); |
| 102 } | 157 } |
| 103 | 158 |
| 104 RenderingHelper::~RenderingHelper() { | 159 RenderingHelper::~RenderingHelper() { |
| 105 CHECK_EQ(videos_.size(), 0U) << "Must call UnInitialize before dtor."; | 160 CHECK_EQ(videos_.size(), 0U) << "Must call UnInitialize before dtor."; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 120 base::Bind(&RenderingHelper::RenderContent, base::Unretained(this))); | 175 base::Bind(&RenderingHelper::RenderContent, base::Unretained(this))); |
| 121 | 176 |
| 122 frame_duration_ = params.rendering_fps > 0 | 177 frame_duration_ = params.rendering_fps > 0 |
| 123 ? base::TimeDelta::FromSeconds(1) / params.rendering_fps | 178 ? base::TimeDelta::FromSeconds(1) / params.rendering_fps |
| 124 : base::TimeDelta(); | 179 : base::TimeDelta(); |
| 125 | 180 |
| 126 render_as_thumbnails_ = params.render_as_thumbnails; | 181 render_as_thumbnails_ = params.render_as_thumbnails; |
| 127 message_loop_ = base::MessageLoop::current(); | 182 message_loop_ = base::MessageLoop::current(); |
| 128 | 183 |
| 129 #if defined(OS_WIN) | 184 #if defined(OS_WIN) |
| 130 screen_size_ = | |
| 131 gfx::Size(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); | |
| 132 window_ = CreateWindowEx(0, | 185 window_ = CreateWindowEx(0, |
| 133 L"Static", | 186 L"Static", |
| 134 L"VideoDecodeAcceleratorTest", | 187 L"VideoDecodeAcceleratorTest", |
| 135 WS_OVERLAPPEDWINDOW | WS_VISIBLE, | 188 WS_OVERLAPPEDWINDOW | WS_VISIBLE, |
| 136 0, | 189 0, |
| 137 0, | 190 0, |
| 138 screen_size_.width(), | 191 GetSystemMetrics(SM_CXSCREEN), |
| 139 screen_size_.height(), | 192 GetSystemMetrics(SM_CYSCREEN), |
| 140 NULL, | 193 NULL, |
| 141 NULL, | 194 NULL, |
| 142 NULL, | 195 NULL, |
| 143 NULL); | 196 NULL); |
| 144 #elif defined(USE_X11) | 197 #elif defined(USE_X11) |
| 145 Display* display = gfx::GetXDisplay(); | 198 Display* display = gfx::GetXDisplay(); |
| 146 Screen* screen = DefaultScreenOfDisplay(display); | 199 Screen* screen = DefaultScreenOfDisplay(display); |
| 147 screen_size_ = gfx::Size(XWidthOfScreen(screen), XHeightOfScreen(screen)); | |
| 148 | 200 |
| 149 CHECK(display); | 201 CHECK(display); |
| 150 | 202 |
| 151 XSetWindowAttributes window_attributes; | 203 XSetWindowAttributes window_attributes; |
| 152 memset(&window_attributes, 0, sizeof(window_attributes)); | 204 memset(&window_attributes, 0, sizeof(window_attributes)); |
| 153 window_attributes.background_pixel = | 205 window_attributes.background_pixel = |
| 154 BlackPixel(display, DefaultScreen(display)); | 206 BlackPixel(display, DefaultScreen(display)); |
| 155 window_attributes.override_redirect = true; | 207 window_attributes.override_redirect = true; |
| 156 int depth = DefaultDepth(display, DefaultScreen(display)); | 208 int depth = DefaultDepth(display, DefaultScreen(display)); |
| 157 | 209 |
| 158 window_ = XCreateWindow(display, | 210 window_ = XCreateWindow(display, |
| 159 DefaultRootWindow(display), | 211 DefaultRootWindow(display), |
| 160 0, | 212 0, |
| 161 0, | 213 0, |
| 162 screen_size_.width(), | 214 XWidthOfScreen(screen), |
| 163 screen_size_.height(), | 215 XHeightOfScreen(screen), |
| 164 0 /* border width */, | 216 0 /* border width */, |
| 165 depth, | 217 depth, |
| 166 CopyFromParent /* class */, | 218 CopyFromParent /* class */, |
| 167 CopyFromParent /* visual */, | 219 CopyFromParent /* visual */, |
| 168 (CWBackPixel | CWOverrideRedirect), | 220 (CWBackPixel | CWOverrideRedirect), |
| 169 &window_attributes); | 221 &window_attributes); |
| 170 XStoreName(display, window_, "VideoDecodeAcceleratorTest"); | 222 XStoreName(display, window_, "VideoDecodeAcceleratorTest"); |
| 171 XSelectInput(display, window_, ExposureMask); | 223 XSelectInput(display, window_, ExposureMask); |
| 172 XMapWindow(display, window_); | 224 XMapWindow(display, window_); |
| 225 #elif defined(USE_OZONE) |
| 226 platform_window_delegate_.reset(new RenderingHelper::StubOzoneDelegate()); |
| 227 window_ = platform_window_delegate_->GetAcceleratedWidget(); |
| 173 #else | 228 #else |
| 174 #error unknown platform | 229 #error unknown platform |
| 175 #endif | 230 #endif |
| 176 CHECK(window_ != gfx::kNullAcceleratedWidget); | 231 CHECK(window_ != gfx::kNullAcceleratedWidget); |
| 177 | 232 |
| 178 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_); | 233 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_); |
| 234 screen_size_ = gl_surface_->GetSize(); |
| 235 |
| 179 gl_context_ = gfx::GLContext::CreateGLContext( | 236 gl_context_ = gfx::GLContext::CreateGLContext( |
| 180 NULL, gl_surface_.get(), gfx::PreferIntegratedGpu); | 237 NULL, gl_surface_.get(), gfx::PreferIntegratedGpu); |
| 181 gl_context_->MakeCurrent(gl_surface_.get()); | 238 CHECK(gl_context_->MakeCurrent(gl_surface_.get())); |
| 182 | 239 |
| 183 CHECK_GT(params.window_sizes.size(), 0U); | 240 CHECK_GT(params.window_sizes.size(), 0U); |
| 184 videos_.resize(params.window_sizes.size()); | 241 videos_.resize(params.window_sizes.size()); |
| 185 LayoutRenderingAreas(params.window_sizes); | 242 LayoutRenderingAreas(params.window_sizes); |
| 186 | 243 |
| 187 if (render_as_thumbnails_) { | 244 if (render_as_thumbnails_) { |
| 188 CHECK_EQ(videos_.size(), 1U); | 245 CHECK_EQ(videos_.size(), 1U); |
| 189 | 246 |
| 190 GLint max_texture_size; | 247 GLint max_texture_size; |
| 191 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); | 248 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 if (tex_external != -1) { | 354 if (tex_external != -1) { |
| 298 glUniform1i(tex_external, 1); | 355 glUniform1i(tex_external, 1); |
| 299 } | 356 } |
| 300 int pos_location = glGetAttribLocation(program_, "in_pos"); | 357 int pos_location = glGetAttribLocation(program_, "in_pos"); |
| 301 glEnableVertexAttribArray(pos_location); | 358 glEnableVertexAttribArray(pos_location); |
| 302 glVertexAttribPointer(pos_location, 2, GL_FLOAT, GL_FALSE, 0, kVertices); | 359 glVertexAttribPointer(pos_location, 2, GL_FLOAT, GL_FALSE, 0, kVertices); |
| 303 int tc_location = glGetAttribLocation(program_, "in_tc"); | 360 int tc_location = glGetAttribLocation(program_, "in_tc"); |
| 304 glEnableVertexAttribArray(tc_location); | 361 glEnableVertexAttribArray(tc_location); |
| 305 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, kTextureCoords); | 362 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, kTextureCoords); |
| 306 | 363 |
| 307 if (frame_duration_ != base::TimeDelta()) | 364 if (frame_duration_ == base::TimeDelta()) |
| 308 WarmUpRendering(params.warm_up_iterations); | 365 done->Signal(); |
| 366 else { |
| 367 int warm_up_iterations = params.warm_up_iterations; |
| 368 #if defined(USE_OZONE) |
| 369 // On Ozone the VSyncProvider can't provide a vsync_internal until |
| 370 // we render at least a frame, so we warm up with at least one |
| 371 // frame. |
| 372 // On top of this, we want to make sure all the buffers backing |
| 373 // the GL surface are cleared, otherwise we can see the previous |
| 374 // test's last frames, so we set warm up iterations to 2, to clear |
| 375 // the front and back buffers. |
| 376 warm_up_iterations = std::max(2, warm_up_iterations); |
| 377 #endif |
| 378 if (warm_up_iterations > 0) |
| 379 WarmUpRendering(warm_up_iterations); |
| 309 | 380 |
| 310 // It's safe to use Unretained here since |rendering_thread_| will be stopped | 381 // It's safe to use Unretained here since |rendering_thread_| will |
| 311 // in VideoDecodeAcceleratorTest.TearDown(), while the |rendering_helper_| is | 382 // be stopped in VideoDecodeAcceleratorTest.TearDown(), while the |
| 312 // a member of that class. (See video_decode_accelerator_unittest.cc.) | 383 // |rendering_helper_| is a member of that class. (See |
| 313 gl_surface_->GetVSyncProvider()->GetVSyncParameters(base::Bind( | 384 // video_decode_accelerator_unittest.cc.) |
| 314 &RenderingHelper::UpdateVSyncParameters, base::Unretained(this), done)); | 385 gl_surface_->GetVSyncProvider()->GetVSyncParameters(base::Bind( |
| 386 &RenderingHelper::UpdateVSyncParameters, base::Unretained(this), done)); |
| 387 } |
| 315 } | 388 } |
| 316 | 389 |
| 317 // The rendering for the first few frames is slow (e.g., 100ms on Peach Pit). | 390 // The rendering for the first few frames is slow (e.g., 100ms on Peach Pit). |
| 318 // This affects the numbers measured in the performance test. We try to render | 391 // This affects the numbers measured in the performance test. We try to render |
| 319 // several frames here to warm up the rendering. | 392 // several frames here to warm up the rendering. |
| 320 void RenderingHelper::WarmUpRendering(int warm_up_iterations) { | 393 void RenderingHelper::WarmUpRendering(int warm_up_iterations) { |
| 321 unsigned int texture_id; | 394 unsigned int texture_id; |
| 322 scoped_ptr<GLubyte[]> emptyData(new GLubyte[screen_size_.GetArea() * 2]); | 395 scoped_ptr<GLubyte[]> emptyData(new GLubyte[screen_size_.GetArea() * 2]()); |
| 323 glGenTextures(1, &texture_id); | 396 glGenTextures(1, &texture_id); |
| 324 glBindTexture(GL_TEXTURE_2D, texture_id); | 397 glBindTexture(GL_TEXTURE_2D, texture_id); |
| 325 glTexImage2D(GL_TEXTURE_2D, | 398 glTexImage2D(GL_TEXTURE_2D, |
| 326 0, | 399 0, |
| 327 GL_RGB, | 400 GL_RGB, |
| 328 screen_size_.width(), | 401 screen_size_.width(), |
| 329 screen_size_.height(), | 402 screen_size_.height(), |
| 330 0, | 403 0, |
| 331 GL_RGB, | 404 GL_RGB, |
| 332 GL_UNSIGNED_SHORT_5_6_5, | 405 GL_UNSIGNED_SHORT_5_6_5, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 glBindTexture(texture_target, 0); | 529 glBindTexture(texture_target, 0); |
| 457 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); | 530 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); |
| 458 } | 531 } |
| 459 | 532 |
| 460 void RenderingHelper::DeleteTexture(uint32 texture_id) { | 533 void RenderingHelper::DeleteTexture(uint32 texture_id) { |
| 461 CHECK_EQ(base::MessageLoop::current(), message_loop_); | 534 CHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 462 glDeleteTextures(1, &texture_id); | 535 glDeleteTextures(1, &texture_id); |
| 463 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); | 536 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); |
| 464 } | 537 } |
| 465 | 538 |
| 466 void* RenderingHelper::GetGLContext() { | 539 scoped_refptr<gfx::GLContext> RenderingHelper::GetGLContext() { |
| 540 return gl_context_; |
| 541 } |
| 542 |
| 543 void* RenderingHelper::GetGLContextHandle() { |
| 467 return gl_context_->GetHandle(); | 544 return gl_context_->GetHandle(); |
| 468 } | 545 } |
| 469 | 546 |
| 470 void* RenderingHelper::GetGLDisplay() { | 547 void* RenderingHelper::GetGLDisplay() { |
| 471 return gl_surface_->GetDisplay(); | 548 return gl_surface_->GetDisplay(); |
| 472 } | 549 } |
| 473 | 550 |
| 474 void RenderingHelper::Clear() { | 551 void RenderingHelper::Clear() { |
| 475 videos_.clear(); | 552 videos_.clear(); |
| 476 message_loop_ = NULL; | 553 message_loop_ = NULL; |
| 477 gl_context_ = NULL; | 554 gl_context_ = NULL; |
| 478 gl_surface_ = NULL; | 555 gl_surface_ = NULL; |
| 479 | 556 |
| 480 render_as_thumbnails_ = false; | 557 render_as_thumbnails_ = false; |
| 481 frame_count_ = 0; | 558 frame_count_ = 0; |
| 482 thumbnails_fbo_id_ = 0; | 559 thumbnails_fbo_id_ = 0; |
| 483 thumbnails_texture_id_ = 0; | 560 thumbnails_texture_id_ = 0; |
| 484 | 561 |
| 485 #if defined(OS_WIN) | 562 #if defined(OS_WIN) |
| 486 if (window_) | 563 if (window_) |
| 487 DestroyWindow(window_); | 564 DestroyWindow(window_); |
| 488 #else | 565 #elif defined(USE_X11) |
| 489 // Destroy resources acquired in Initialize, in reverse-acquisition order. | 566 // Destroy resources acquired in Initialize, in reverse-acquisition order. |
| 490 if (window_) { | 567 if (window_) { |
| 491 CHECK(XUnmapWindow(gfx::GetXDisplay(), window_)); | 568 CHECK(XUnmapWindow(gfx::GetXDisplay(), window_)); |
| 492 CHECK(XDestroyWindow(gfx::GetXDisplay(), window_)); | 569 CHECK(XDestroyWindow(gfx::GetXDisplay(), window_)); |
| 493 } | 570 } |
| 571 #elif defined(USE_OZONE) |
| 572 platform_window_delegate_.reset(); |
| 494 #endif | 573 #endif |
| 495 window_ = gfx::kNullAcceleratedWidget; | 574 window_ = gfx::kNullAcceleratedWidget; |
| 496 } | 575 } |
| 497 | 576 |
| 498 void RenderingHelper::GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, | 577 void RenderingHelper::GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, |
| 499 bool* alpha_solid, | 578 bool* alpha_solid, |
| 500 base::WaitableEvent* done) { | 579 base::WaitableEvent* done) { |
| 501 CHECK(render_as_thumbnails_); | 580 CHECK(render_as_thumbnails_); |
| 502 | 581 |
| 503 const size_t num_pixels = thumbnails_fbo_size_.GetArea(); | 582 const size_t num_pixels = thumbnails_fbo_size_.GetArea(); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 // When the rendering falls behind, drops frames. | 756 // When the rendering falls behind, drops frames. |
| 678 while (scheduled_render_time_ < target) { | 757 while (scheduled_render_time_ < target) { |
| 679 scheduled_render_time_ += frame_duration_; | 758 scheduled_render_time_ += frame_duration_; |
| 680 DropOneFrameForAllVideos(); | 759 DropOneFrameForAllVideos(); |
| 681 } | 760 } |
| 682 | 761 |
| 683 message_loop_->PostDelayedTask( | 762 message_loop_->PostDelayedTask( |
| 684 FROM_HERE, render_task_.callback(), target - now); | 763 FROM_HERE, render_task_.callback(), target - now); |
| 685 } | 764 } |
| 686 } // namespace content | 765 } // namespace content |
| OLD | NEW |