| 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 "media/gpu/rendering_helper.h" | 5 #include "media/gpu/rendering_helper.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 namespace { | 79 namespace { |
| 80 | 80 |
| 81 void WaitForSwapAck(const base::Closure& callback, gfx::SwapResult result) { | 81 void WaitForSwapAck(const base::Closure& callback, gfx::SwapResult result) { |
| 82 callback.Run(); | 82 callback.Run(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace | 85 } // namespace |
| 86 | 86 |
| 87 #if defined(USE_OZONE) | 87 #if defined(USE_OZONE) |
| 88 | 88 |
| 89 class DisplayConfiguratorObserver : public ui::DisplayConfigurator::Observer { | 89 class DisplayConfiguratorObserver |
| 90 : public display::DisplayConfigurator::Observer { |
| 90 public: | 91 public: |
| 91 explicit DisplayConfiguratorObserver(base::RunLoop* loop) : loop_(loop) {} | 92 explicit DisplayConfiguratorObserver(base::RunLoop* loop) : loop_(loop) {} |
| 92 ~DisplayConfiguratorObserver() override {} | 93 ~DisplayConfiguratorObserver() override {} |
| 93 | 94 |
| 94 private: | 95 private: |
| 95 // ui::DisplayConfigurator::Observer overrides: | 96 // display::DisplayConfigurator::Observer overrides: |
| 96 void OnDisplayModeChanged( | 97 void OnDisplayModeChanged( |
| 97 const ui::DisplayConfigurator::DisplayStateList& outputs) override { | 98 const display::DisplayConfigurator::DisplayStateList& outputs) override { |
| 98 if (!loop_) | 99 if (!loop_) |
| 99 return; | 100 return; |
| 100 loop_->Quit(); | 101 loop_->Quit(); |
| 101 loop_ = nullptr; | 102 loop_ = nullptr; |
| 102 } | 103 } |
| 103 void OnDisplayModeChangeFailed( | 104 void OnDisplayModeChangeFailed( |
| 104 const ui::DisplayConfigurator::DisplayStateList& outputs, | 105 const display::DisplayConfigurator::DisplayStateList& outputs, |
| 105 ui::MultipleDisplayState failed_new_state) override { | 106 display::MultipleDisplayState failed_new_state) override { |
| 106 LOG(FATAL) << "Could not configure display"; | 107 LOG(FATAL) << "Could not configure display"; |
| 107 } | 108 } |
| 108 | 109 |
| 109 base::RunLoop* loop_; | 110 base::RunLoop* loop_; |
| 110 | 111 |
| 111 DISALLOW_COPY_AND_ASSIGN(DisplayConfiguratorObserver); | 112 DISALLOW_COPY_AND_ASSIGN(DisplayConfiguratorObserver); |
| 112 }; | 113 }; |
| 113 | 114 |
| 114 class RenderingHelper::StubOzoneDelegate : public ui::PlatformWindowDelegate { | 115 class RenderingHelper::StubOzoneDelegate : public ui::PlatformWindowDelegate { |
| 115 public: | 116 public: |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 gfx::Size window_size(800, 600); | 251 gfx::Size window_size(800, 600); |
| 251 // Ignore the vsync provider by default. On ChromeOS this will be set | 252 // Ignore the vsync provider by default. On ChromeOS this will be set |
| 252 // accordingly based on the display configuration. | 253 // accordingly based on the display configuration. |
| 253 ignore_vsync_ = true; | 254 ignore_vsync_ = true; |
| 254 #if defined(OS_CHROMEOS) | 255 #if defined(OS_CHROMEOS) |
| 255 // We hold onto the main loop here to wait for the DisplayController | 256 // We hold onto the main loop here to wait for the DisplayController |
| 256 // to give us the size of the display so we can create a window of | 257 // to give us the size of the display so we can create a window of |
| 257 // the same size. | 258 // the same size. |
| 258 base::RunLoop wait_display_setup; | 259 base::RunLoop wait_display_setup; |
| 259 DisplayConfiguratorObserver display_setup_observer(&wait_display_setup); | 260 DisplayConfiguratorObserver display_setup_observer(&wait_display_setup); |
| 260 display_configurator_.reset(new ui::DisplayConfigurator()); | 261 display_configurator_.reset(new display::DisplayConfigurator()); |
| 261 display_configurator_->SetDelegateForTesting(0); | 262 display_configurator_->SetDelegateForTesting(0); |
| 262 display_configurator_->AddObserver(&display_setup_observer); | 263 display_configurator_->AddObserver(&display_setup_observer); |
| 263 display_configurator_->Init( | 264 display_configurator_->Init( |
| 264 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(), true); | 265 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(), true); |
| 265 display_configurator_->ForceInitialConfigure(0); | 266 display_configurator_->ForceInitialConfigure(0); |
| 266 // Make sure all the display configuration is applied. | 267 // Make sure all the display configuration is applied. |
| 267 wait_display_setup.Run(); | 268 wait_display_setup.Run(); |
| 268 display_configurator_->RemoveObserver(&display_setup_observer); | 269 display_configurator_->RemoveObserver(&display_setup_observer); |
| 269 | 270 |
| 270 gfx::Size framebuffer_size = display_configurator_->framebuffer_size(); | 271 gfx::Size framebuffer_size = display_configurator_->framebuffer_size(); |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 // When the rendering falls behind, drops frames. | 889 // When the rendering falls behind, drops frames. |
| 889 while (scheduled_render_time_ < target) { | 890 while (scheduled_render_time_ < target) { |
| 890 scheduled_render_time_ += frame_duration_; | 891 scheduled_render_time_ += frame_duration_; |
| 891 DropOneFrameForAllVideos(); | 892 DropOneFrameForAllVideos(); |
| 892 } | 893 } |
| 893 | 894 |
| 894 task_runner_->PostDelayedTask(FROM_HERE, render_task_.callback(), | 895 task_runner_->PostDelayedTask(FROM_HERE, render_task_.callback(), |
| 895 target - now); | 896 target - now); |
| 896 } | 897 } |
| 897 } // namespace media | 898 } // namespace media |
| OLD | NEW |