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

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

Issue 972153004: Make ui::DisplayConfigurator a singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make a Singleton Created 5 years, 9 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 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
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 base::RunLoop wait_window_resize; 238 base::RunLoop wait_window_resize;
239 239
240 platform_window_delegate_.reset(new RenderingHelper::StubOzoneDelegate()); 240 platform_window_delegate_.reset(new RenderingHelper::StubOzoneDelegate());
241 window_ = platform_window_delegate_->accelerated_widget(); 241 window_ = platform_window_delegate_->accelerated_widget();
242 #if defined(OS_CHROMEOS) 242 #if defined(OS_CHROMEOS)
243 // We hold onto the main loop here to wait for the DisplayController 243 // We hold onto the main loop here to wait for the DisplayController
244 // to give us the size of the display so we can create a window of 244 // to give us the size of the display so we can create a window of
245 // the same size. 245 // the same size.
246 base::RunLoop wait_display_setup; 246 base::RunLoop wait_display_setup;
247 DisplayConfiguratorObserver display_setup_observer(&wait_display_setup); 247 DisplayConfiguratorObserver display_setup_observer(&wait_display_setup);
248 display_configurator_.reset(new ui::DisplayConfigurator()); 248 display_configurator_ = DisplayConfigurator::GetInstance();
249 display_configurator_->AddObserver(&display_setup_observer); 249 display_configurator_->AddObserver(&display_setup_observer);
250 display_configurator_->Init(true); 250 display_configurator_->Init(true);
251 display_configurator_->ForceInitialConfigure(0); 251 display_configurator_->ForceInitialConfigure(0);
252 // Make sure all the display configuration is applied. 252 // Make sure all the display configuration is applied.
253 wait_display_setup.Run(); 253 wait_display_setup.Run();
254 display_configurator_->RemoveObserver(&display_setup_observer); 254 display_configurator_->RemoveObserver(&display_setup_observer);
255 255
256 platform_window_delegate_->platform_window()->SetBounds( 256 platform_window_delegate_->platform_window()->SetBounds(
257 gfx::Rect(display_configurator_->framebuffer_size())); 257 gfx::Rect(display_configurator_->framebuffer_size()));
258 #else 258 #else
(...skipping 21 matching lines...) Expand all
280 #elif defined(USE_X11) 280 #elif defined(USE_X11)
281 // Destroy resources acquired in Initialize, in reverse-acquisition order. 281 // Destroy resources acquired in Initialize, in reverse-acquisition order.
282 if (window_) { 282 if (window_) {
283 CHECK(XUnmapWindow(gfx::GetXDisplay(), window_)); 283 CHECK(XUnmapWindow(gfx::GetXDisplay(), window_));
284 CHECK(XDestroyWindow(gfx::GetXDisplay(), window_)); 284 CHECK(XDestroyWindow(gfx::GetXDisplay(), window_));
285 } 285 }
286 #elif defined(USE_OZONE) 286 #elif defined(USE_OZONE)
287 platform_window_delegate_.reset(); 287 platform_window_delegate_.reset();
288 #if defined(OS_CHROMEOS) 288 #if defined(OS_CHROMEOS)
289 display_configurator_->PrepareForExit(); 289 display_configurator_->PrepareForExit();
290 display_configurator_.reset();
291 #endif 290 #endif
292 #endif 291 #endif
293 window_ = gfx::kNullAcceleratedWidget; 292 window_ = gfx::kNullAcceleratedWidget;
294 } 293 }
295 294
296 void RenderingHelper::Initialize(const RenderingHelperParams& params, 295 void RenderingHelper::Initialize(const RenderingHelperParams& params,
297 base::WaitableEvent* done) { 296 base::WaitableEvent* done) {
298 // Use videos_.size() != 0 as a proxy for the class having already been 297 // Use videos_.size() != 0 as a proxy for the class having already been
299 // Initialize()'d, and UnInitialize() before continuing. 298 // Initialize()'d, and UnInitialize() before continuing.
300 if (videos_.size()) { 299 if (videos_.size()) {
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 // When the rendering falls behind, drops frames. 843 // When the rendering falls behind, drops frames.
845 while (scheduled_render_time_ < target) { 844 while (scheduled_render_time_ < target) {
846 scheduled_render_time_ += frame_duration_; 845 scheduled_render_time_ += frame_duration_;
847 DropOneFrameForAllVideos(); 846 DropOneFrameForAllVideos();
848 } 847 }
849 848
850 message_loop_->PostDelayedTask( 849 message_loop_->PostDelayedTask(
851 FROM_HERE, render_task_.callback(), target - now); 850 FROM_HERE, render_task_.callback(), target - now);
852 } 851 }
853 } // namespace content 852 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/rendering_helper.h ('k') | extensions/shell/browser/shell_desktop_controller_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698