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

Side by Side Diff: content/common/gpu/media/rendering_helper.cc

Issue 490233002: VaapiVideoAccelerator: make Vaapi accelerator work with ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on ToT Created 6 years 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 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 #if defined(OS_CHROMEOS)
41 #include "ui/display/chromeos/display_configurator.h"
42 #endif
43 #include "ui/ozone/public/ozone_platform.h"
44 #include "ui/ozone/public/ui_thread_gpu.h"
45 #include "ui/platform_window/platform_window.h"
46 #include "ui/platform_window/platform_window_delegate.h"
47 #endif
48
39 // Helper for Shader creation. 49 // Helper for Shader creation.
40 static void CreateShader(GLuint program, 50 static void CreateShader(GLuint program,
41 GLenum type, 51 GLenum type,
42 const char* source, 52 const char* source,
43 int size) { 53 int size) {
44 GLuint shader = glCreateShader(type); 54 GLuint shader = glCreateShader(type);
45 glShaderSource(shader, 1, &source, &size); 55 glShaderSource(shader, 1, &source, &size);
46 glCompileShader(shader); 56 glCompileShader(shader);
47 int result = GL_FALSE; 57 int result = GL_FALSE;
48 glGetShaderiv(shader, GL_COMPILE_STATUS, &result); 58 glGetShaderiv(shader, GL_COMPILE_STATUS, &result);
49 if (!result) { 59 if (!result) {
50 char log[4096]; 60 char log[4096];
51 glGetShaderInfoLog(shader, arraysize(log), NULL, log); 61 glGetShaderInfoLog(shader, arraysize(log), NULL, log);
52 LOG(FATAL) << log; 62 LOG(FATAL) << log;
53 } 63 }
54 glAttachShader(program, shader); 64 glAttachShader(program, shader);
55 glDeleteShader(shader); 65 glDeleteShader(shader);
56 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); 66 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR);
57 } 67 }
58 68
59 namespace content { 69 namespace content {
60 70
71 #if defined(USE_OZONE)
72
73 class RenderingHelper::StubOzoneDelegate : public ui::PlatformWindowDelegate {
74 public:
75 StubOzoneDelegate() : accelerated_widget_(gfx::kNullAcceleratedWidget) {
76 ui_thread_gpu_.Initialize();
77 platform_window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow(
78 this, gfx::Rect());
79 }
80 virtual ~StubOzoneDelegate() {}
81
82 void OnBoundsChanged(const gfx::Rect& new_bounds) override {}
83
84 void OnDamageRect(const gfx::Rect& damaged_region) override {}
85
86 void DispatchEvent(ui::Event* event) override {}
87
88 void OnCloseRequest() override {}
89 void OnClosed() override {}
90
91 void OnWindowStateChanged(ui::PlatformWindowState new_state) override {}
92
93 void OnLostCapture() override {};
94
95 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override {
96 accelerated_widget_ = widget;
97 };
98
99 void OnActivationChanged(bool active) override {};
100
101 gfx::AcceleratedWidget accelerated_widget() const {
102 return accelerated_widget_;
103 }
104
105 gfx::Size GetSize() { return platform_window_->GetBounds().size(); }
106
107 ui::PlatformWindow* platform_window() const { return platform_window_.get(); }
108
109 private:
110 ui::UiThreadGpu ui_thread_gpu_;
111 scoped_ptr<ui::PlatformWindow> platform_window_;
112 gfx::AcceleratedWidget accelerated_widget_;
113
114 DISALLOW_COPY_AND_ASSIGN(StubOzoneDelegate);
115 };
116
117 #endif // defined(USE_OZONE)
118
61 RenderingHelperParams::RenderingHelperParams() 119 RenderingHelperParams::RenderingHelperParams()
62 : rendering_fps(0), warm_up_iterations(0), render_as_thumbnails(false) { 120 : rendering_fps(0), warm_up_iterations(0), render_as_thumbnails(false) {
63 } 121 }
64 122
65 RenderingHelperParams::~RenderingHelperParams() {} 123 RenderingHelperParams::~RenderingHelperParams() {}
66 124
67 VideoFrameTexture::VideoFrameTexture(uint32 texture_target, 125 VideoFrameTexture::VideoFrameTexture(uint32 texture_target,
68 uint32 texture_id, 126 uint32 texture_id,
69 const base::Closure& no_longer_needed_cb) 127 const base::Closure& no_longer_needed_cb)
70 : texture_target_(texture_target), 128 : texture_target_(texture_target),
(...skipping 15 matching lines...) Expand all
86 144
87 // static 145 // static
88 bool RenderingHelper::InitializeOneOff() { 146 bool RenderingHelper::InitializeOneOff() {
89 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 147 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
90 #if GL_VARIANT_GLX 148 #if GL_VARIANT_GLX
91 cmd_line->AppendSwitchASCII(switches::kUseGL, 149 cmd_line->AppendSwitchASCII(switches::kUseGL,
92 gfx::kGLImplementationDesktopName); 150 gfx::kGLImplementationDesktopName);
93 #else 151 #else
94 cmd_line->AppendSwitchASCII(switches::kUseGL, gfx::kGLImplementationEGLName); 152 cmd_line->AppendSwitchASCII(switches::kUseGL, gfx::kGLImplementationEGLName);
95 #endif 153 #endif
154
155 #if defined(USE_OZONE)
156 ui::OzonePlatform::InitializeForUI();
157 #endif
96 return gfx::GLSurface::InitializeOneOff(); 158 return gfx::GLSurface::InitializeOneOff();
97 } 159 }
98 160
99 RenderingHelper::RenderingHelper() { 161 RenderingHelper::RenderingHelper() {
100 window_ = gfx::kNullAcceleratedWidget; 162 window_ = gfx::kNullAcceleratedWidget;
101 Clear(); 163 Clear();
102 } 164 }
103 165
104 RenderingHelper::~RenderingHelper() { 166 RenderingHelper::~RenderingHelper() {
105 CHECK_EQ(videos_.size(), 0U) << "Must call UnInitialize before dtor."; 167 CHECK_EQ(videos_.size(), 0U) << "Must call UnInitialize before dtor.";
(...skipping 14 matching lines...) Expand all
120 base::Bind(&RenderingHelper::RenderContent, base::Unretained(this))); 182 base::Bind(&RenderingHelper::RenderContent, base::Unretained(this)));
121 183
122 frame_duration_ = params.rendering_fps > 0 184 frame_duration_ = params.rendering_fps > 0
123 ? base::TimeDelta::FromSeconds(1) / params.rendering_fps 185 ? base::TimeDelta::FromSeconds(1) / params.rendering_fps
124 : base::TimeDelta(); 186 : base::TimeDelta();
125 187
126 render_as_thumbnails_ = params.render_as_thumbnails; 188 render_as_thumbnails_ = params.render_as_thumbnails;
127 message_loop_ = base::MessageLoop::current(); 189 message_loop_ = base::MessageLoop::current();
128 190
129 #if defined(OS_WIN) 191 #if defined(OS_WIN)
130 screen_size_ =
131 gfx::Size(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
132 window_ = CreateWindowEx(0, 192 window_ = CreateWindowEx(0,
133 L"Static", 193 L"Static",
134 L"VideoDecodeAcceleratorTest", 194 L"VideoDecodeAcceleratorTest",
135 WS_OVERLAPPEDWINDOW | WS_VISIBLE, 195 WS_OVERLAPPEDWINDOW | WS_VISIBLE,
136 0, 196 0,
137 0, 197 0,
138 screen_size_.width(), 198 GetSystemMetrics(SM_CXSCREEN),
139 screen_size_.height(), 199 GetSystemMetrics(SM_CYSCREEN),
140 NULL, 200 NULL,
141 NULL, 201 NULL,
142 NULL, 202 NULL,
143 NULL); 203 NULL);
144 #elif defined(USE_X11) 204 #elif defined(USE_X11)
145 Display* display = gfx::GetXDisplay(); 205 Display* display = gfx::GetXDisplay();
146 Screen* screen = DefaultScreenOfDisplay(display); 206 Screen* screen = DefaultScreenOfDisplay(display);
147 screen_size_ = gfx::Size(XWidthOfScreen(screen), XHeightOfScreen(screen));
148 207
149 CHECK(display); 208 CHECK(display);
150 209
151 XSetWindowAttributes window_attributes; 210 XSetWindowAttributes window_attributes;
152 memset(&window_attributes, 0, sizeof(window_attributes)); 211 memset(&window_attributes, 0, sizeof(window_attributes));
153 window_attributes.background_pixel = 212 window_attributes.background_pixel =
154 BlackPixel(display, DefaultScreen(display)); 213 BlackPixel(display, DefaultScreen(display));
155 window_attributes.override_redirect = true; 214 window_attributes.override_redirect = true;
156 int depth = DefaultDepth(display, DefaultScreen(display)); 215 int depth = DefaultDepth(display, DefaultScreen(display));
157 216
158 window_ = XCreateWindow(display, 217 window_ = XCreateWindow(display,
159 DefaultRootWindow(display), 218 DefaultRootWindow(display),
160 0, 219 0,
161 0, 220 0,
162 screen_size_.width(), 221 XWidthOfScreen(screen),
163 screen_size_.height(), 222 XHeightOfScreen(screen),
164 0 /* border width */, 223 0 /* border width */,
165 depth, 224 depth,
166 CopyFromParent /* class */, 225 CopyFromParent /* class */,
167 CopyFromParent /* visual */, 226 CopyFromParent /* visual */,
168 (CWBackPixel | CWOverrideRedirect), 227 (CWBackPixel | CWOverrideRedirect),
169 &window_attributes); 228 &window_attributes);
170 XStoreName(display, window_, "VideoDecodeAcceleratorTest"); 229 XStoreName(display, window_, "VideoDecodeAcceleratorTest");
171 XSelectInput(display, window_, ExposureMask); 230 XSelectInput(display, window_, ExposureMask);
172 XMapWindow(display, window_); 231 XMapWindow(display, window_);
232 #elif defined(USE_OZONE)
233 platform_window_delegate_.reset(new RenderingHelper::StubOzoneDelegate());
234 window_ = platform_window_delegate_->accelerated_widget();
235 #if defined(OS_CHROMEOS)
236 display_configurator_.reset(new ui::DisplayConfigurator());
237 display_configurator_->Init(true);
238 display_configurator_->ForceInitialConfigure(0);
239 platform_window_delegate_->platform_window()->SetBounds(
240 gfx::Rect(display_configurator_->framebuffer_size()));
241 #else
242 platform_window_delegate_->platform_window()->SetBounds(gfx::Rect(800, 600));
243 #endif
173 #else 244 #else
174 #error unknown platform 245 #error unknown platform
175 #endif 246 #endif
176 CHECK(window_ != gfx::kNullAcceleratedWidget); 247 CHECK(window_ != gfx::kNullAcceleratedWidget);
177 248
178 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_); 249 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_);
250 screen_size_ = gl_surface_->GetSize();
251
179 gl_context_ = gfx::GLContext::CreateGLContext( 252 gl_context_ = gfx::GLContext::CreateGLContext(
180 NULL, gl_surface_.get(), gfx::PreferIntegratedGpu); 253 NULL, gl_surface_.get(), gfx::PreferIntegratedGpu);
181 gl_context_->MakeCurrent(gl_surface_.get()); 254 CHECK(gl_context_->MakeCurrent(gl_surface_.get()));
182 255
183 CHECK_GT(params.window_sizes.size(), 0U); 256 CHECK_GT(params.window_sizes.size(), 0U);
184 videos_.resize(params.window_sizes.size()); 257 videos_.resize(params.window_sizes.size());
185 LayoutRenderingAreas(params.window_sizes); 258 LayoutRenderingAreas(params.window_sizes);
186 259
187 if (render_as_thumbnails_) { 260 if (render_as_thumbnails_) {
188 CHECK_EQ(videos_.size(), 1U); 261 CHECK_EQ(videos_.size(), 1U);
189 262
190 GLint max_texture_size; 263 GLint max_texture_size;
191 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); 264 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 if (tex_external != -1) { 370 if (tex_external != -1) {
298 glUniform1i(tex_external, 1); 371 glUniform1i(tex_external, 1);
299 } 372 }
300 int pos_location = glGetAttribLocation(program_, "in_pos"); 373 int pos_location = glGetAttribLocation(program_, "in_pos");
301 glEnableVertexAttribArray(pos_location); 374 glEnableVertexAttribArray(pos_location);
302 glVertexAttribPointer(pos_location, 2, GL_FLOAT, GL_FALSE, 0, kVertices); 375 glVertexAttribPointer(pos_location, 2, GL_FLOAT, GL_FALSE, 0, kVertices);
303 int tc_location = glGetAttribLocation(program_, "in_tc"); 376 int tc_location = glGetAttribLocation(program_, "in_tc");
304 glEnableVertexAttribArray(tc_location); 377 glEnableVertexAttribArray(tc_location);
305 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, kTextureCoords); 378 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, kTextureCoords);
306 379
307 if (frame_duration_ != base::TimeDelta()) 380 if (frame_duration_ != base::TimeDelta()) {
308 WarmUpRendering(params.warm_up_iterations); 381 int warm_up_iterations = params.warm_up_iterations;
382 #if defined(USE_OZONE)
383 // On Ozone the VSyncProvider can't provide a vsync_internal until
384 // we render at least a frame, so we warm up with at least one
385 // frame.
386 // On top of this, we want to make sure all the buffers backing
387 // the GL surface are cleared, otherwise we can see the previous
388 // test's last frames, so we set warm up iterations to 2, to clear
389 // the front and back buffers.
390 warm_up_iterations = std::max(2, warm_up_iterations);
391 #endif
392 WarmUpRendering(warm_up_iterations);
393 }
309 394
310 // It's safe to use Unretained here since |rendering_thread_| will be stopped 395 // It's safe to use Unretained here since |rendering_thread_| will be stopped
311 // in VideoDecodeAcceleratorTest.TearDown(), while the |rendering_helper_| is 396 // in VideoDecodeAcceleratorTest.TearDown(), while the |rendering_helper_| is
312 // a member of that class. (See video_decode_accelerator_unittest.cc.) 397 // a member of that class. (See video_decode_accelerator_unittest.cc.)
313 gfx::VSyncProvider* vsync_provider = gl_surface_->GetVSyncProvider(); 398 gfx::VSyncProvider* vsync_provider = gl_surface_->GetVSyncProvider();
314 if (vsync_provider) 399 if (vsync_provider && frame_duration_ != base::TimeDelta())
315 vsync_provider->GetVSyncParameters(base::Bind( 400 vsync_provider->GetVSyncParameters(base::Bind(
316 &RenderingHelper::UpdateVSyncParameters, base::Unretained(this), done)); 401 &RenderingHelper::UpdateVSyncParameters, base::Unretained(this), done));
317 else 402 else
318 done->Signal(); 403 done->Signal();
319 } 404 }
320 405
321 // The rendering for the first few frames is slow (e.g., 100ms on Peach Pit). 406 // The rendering for the first few frames is slow (e.g., 100ms on Peach Pit).
322 // This affects the numbers measured in the performance test. We try to render 407 // This affects the numbers measured in the performance test. We try to render
323 // several frames here to warm up the rendering. 408 // several frames here to warm up the rendering.
324 void RenderingHelper::WarmUpRendering(int warm_up_iterations) { 409 void RenderingHelper::WarmUpRendering(int warm_up_iterations) {
325 unsigned int texture_id; 410 unsigned int texture_id;
326 scoped_ptr<GLubyte[]> emptyData(new GLubyte[screen_size_.GetArea() * 2]); 411 scoped_ptr<GLubyte[]> emptyData(new GLubyte[screen_size_.GetArea() * 2]());
327 glGenTextures(1, &texture_id); 412 glGenTextures(1, &texture_id);
328 glBindTexture(GL_TEXTURE_2D, texture_id); 413 glBindTexture(GL_TEXTURE_2D, texture_id);
329 glTexImage2D(GL_TEXTURE_2D, 414 glTexImage2D(GL_TEXTURE_2D,
330 0, 415 0,
331 GL_RGB, 416 GL_RGB,
332 screen_size_.width(), 417 screen_size_.width(),
333 screen_size_.height(), 418 screen_size_.height(),
334 0, 419 0,
335 GL_RGB, 420 GL_RGB,
336 GL_UNSIGNED_SHORT_5_6_5, 421 GL_UNSIGNED_SHORT_5_6_5,
337 emptyData.get()); 422 emptyData.get());
338 for (int i = 0; i < warm_up_iterations; ++i) { 423 for (int i = 0; i < warm_up_iterations; ++i) {
339 RenderTexture(GL_TEXTURE_2D, texture_id); 424 RenderTexture(GL_TEXTURE_2D, texture_id);
340 gl_surface_->SwapBuffers(); 425 gl_surface_->SwapBuffers();
341 } 426 }
342 glDeleteTextures(1, &texture_id); 427 glDeleteTextures(1, &texture_id);
343 } 428 }
344 429
345 void RenderingHelper::UnInitialize(base::WaitableEvent* done) { 430 void RenderingHelper::UnInitialize(base::WaitableEvent* done) {
346 CHECK_EQ(base::MessageLoop::current(), message_loop_); 431 CHECK_EQ(base::MessageLoop::current(), message_loop_);
347 432
433 #if defined(USE_OZONE) && defined(OS_CHROMEOS)
434 display_configurator_->PrepareForExit();
435 #endif
436
348 render_task_.Cancel(); 437 render_task_.Cancel();
349 438
350 if (render_as_thumbnails_) { 439 if (render_as_thumbnails_) {
351 glDeleteTextures(1, &thumbnails_texture_id_); 440 glDeleteTextures(1, &thumbnails_texture_id_);
352 glDeleteFramebuffersEXT(1, &thumbnails_fbo_id_); 441 glDeleteFramebuffersEXT(1, &thumbnails_fbo_id_);
353 } 442 }
354 443
355 gl_context_->ReleaseCurrent(gl_surface_.get()); 444 gl_context_->ReleaseCurrent(gl_surface_.get());
356 gl_context_ = NULL; 445 gl_context_ = NULL;
357 gl_surface_ = NULL; 446 gl_surface_ = NULL;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 glBindTexture(texture_target, 0); 549 glBindTexture(texture_target, 0);
461 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); 550 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR);
462 } 551 }
463 552
464 void RenderingHelper::DeleteTexture(uint32 texture_id) { 553 void RenderingHelper::DeleteTexture(uint32 texture_id) {
465 CHECK_EQ(base::MessageLoop::current(), message_loop_); 554 CHECK_EQ(base::MessageLoop::current(), message_loop_);
466 glDeleteTextures(1, &texture_id); 555 glDeleteTextures(1, &texture_id);
467 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); 556 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR);
468 } 557 }
469 558
470 void* RenderingHelper::GetGLContext() { 559 scoped_refptr<gfx::GLContext> RenderingHelper::GetGLContext() {
560 return gl_context_;
561 }
562
563 void* RenderingHelper::GetGLContextHandle() {
471 return gl_context_->GetHandle(); 564 return gl_context_->GetHandle();
472 } 565 }
473 566
474 void* RenderingHelper::GetGLDisplay() { 567 void* RenderingHelper::GetGLDisplay() {
475 return gl_surface_->GetDisplay(); 568 return gl_surface_->GetDisplay();
476 } 569 }
477 570
478 void RenderingHelper::Clear() { 571 void RenderingHelper::Clear() {
479 videos_.clear(); 572 videos_.clear();
480 message_loop_ = NULL; 573 message_loop_ = NULL;
481 gl_context_ = NULL; 574 gl_context_ = NULL;
482 gl_surface_ = NULL; 575 gl_surface_ = NULL;
483 576
484 render_as_thumbnails_ = false; 577 render_as_thumbnails_ = false;
485 frame_count_ = 0; 578 frame_count_ = 0;
486 thumbnails_fbo_id_ = 0; 579 thumbnails_fbo_id_ = 0;
487 thumbnails_texture_id_ = 0; 580 thumbnails_texture_id_ = 0;
488 581
489 #if defined(OS_WIN) 582 #if defined(OS_WIN)
490 if (window_) 583 if (window_)
491 DestroyWindow(window_); 584 DestroyWindow(window_);
492 #else 585 #elif defined(USE_X11)
493 // Destroy resources acquired in Initialize, in reverse-acquisition order. 586 // Destroy resources acquired in Initialize, in reverse-acquisition order.
494 if (window_) { 587 if (window_) {
495 CHECK(XUnmapWindow(gfx::GetXDisplay(), window_)); 588 CHECK(XUnmapWindow(gfx::GetXDisplay(), window_));
496 CHECK(XDestroyWindow(gfx::GetXDisplay(), window_)); 589 CHECK(XDestroyWindow(gfx::GetXDisplay(), window_));
497 } 590 }
591 #elif defined(USE_OZONE)
592 platform_window_delegate_.reset();
498 #endif 593 #endif
499 window_ = gfx::kNullAcceleratedWidget; 594 window_ = gfx::kNullAcceleratedWidget;
500 } 595 }
501 596
502 void RenderingHelper::GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, 597 void RenderingHelper::GetThumbnailsAsRGB(std::vector<unsigned char>* rgb,
503 bool* alpha_solid, 598 bool* alpha_solid,
504 base::WaitableEvent* done) { 599 base::WaitableEvent* done) {
505 CHECK(render_as_thumbnails_); 600 CHECK(render_as_thumbnails_);
506 601
507 const size_t num_pixels = thumbnails_fbo_size_.GetArea(); 602 const size_t num_pixels = thumbnails_fbo_size_.GetArea();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 // When the rendering falls behind, drops frames. 782 // When the rendering falls behind, drops frames.
688 while (scheduled_render_time_ < target) { 783 while (scheduled_render_time_ < target) {
689 scheduled_render_time_ += frame_duration_; 784 scheduled_render_time_ += frame_duration_;
690 DropOneFrameForAllVideos(); 785 DropOneFrameForAllVideos();
691 } 786 }
692 787
693 message_loop_->PostDelayedTask( 788 message_loop_->PostDelayedTask(
694 FROM_HERE, render_task_.callback(), target - now); 789 FROM_HERE, render_task_.callback(), target - now);
695 } 790 }
696 } // namespace content 791 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698