| 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 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #else | 35 #else |
| 36 #include "ui/gl/gl_surface_egl.h" | 36 #include "ui/gl/gl_surface_egl.h" |
| 37 #define GL_VARIANT_EGL 1 | 37 #define GL_VARIANT_EGL 1 |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 #if defined(USE_OZONE) | 40 #if defined(USE_OZONE) |
| 41 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
| 42 #include "ui/display/chromeos/display_configurator.h" | 42 #include "ui/display/chromeos/display_configurator.h" |
| 43 #endif // defined(OS_CHROMEOS) | 43 #endif // defined(OS_CHROMEOS) |
| 44 #include "ui/ozone/public/ozone_platform.h" | 44 #include "ui/ozone/public/ozone_platform.h" |
| 45 #include "ui/ozone/public/ui_thread_gpu.h" | |
| 46 #include "ui/platform_window/platform_window.h" | 45 #include "ui/platform_window/platform_window.h" |
| 47 #include "ui/platform_window/platform_window_delegate.h" | 46 #include "ui/platform_window/platform_window_delegate.h" |
| 48 #endif // defined(USE_OZONE) | 47 #endif // defined(USE_OZONE) |
| 49 | 48 |
| 50 // Helper for Shader creation. | 49 // Helper for Shader creation. |
| 51 static void CreateShader(GLuint program, | 50 static void CreateShader(GLuint program, |
| 52 GLenum type, | 51 GLenum type, |
| 53 const char* source, | 52 const char* source, |
| 54 int size) { | 53 int size) { |
| 55 GLuint shader = glCreateShader(type); | 54 GLuint shader = glCreateShader(type); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 90 } |
| 92 | 91 |
| 93 base::RunLoop* loop_; | 92 base::RunLoop* loop_; |
| 94 | 93 |
| 95 DISALLOW_COPY_AND_ASSIGN(DisplayConfiguratorObserver); | 94 DISALLOW_COPY_AND_ASSIGN(DisplayConfiguratorObserver); |
| 96 }; | 95 }; |
| 97 | 96 |
| 98 class RenderingHelper::StubOzoneDelegate : public ui::PlatformWindowDelegate { | 97 class RenderingHelper::StubOzoneDelegate : public ui::PlatformWindowDelegate { |
| 99 public: | 98 public: |
| 100 StubOzoneDelegate() : accelerated_widget_(gfx::kNullAcceleratedWidget) { | 99 StubOzoneDelegate() : accelerated_widget_(gfx::kNullAcceleratedWidget) { |
| 101 ui_thread_gpu_.Initialize(); | |
| 102 platform_window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( | 100 platform_window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( |
| 103 this, gfx::Rect()); | 101 this, gfx::Rect()); |
| 104 } | 102 } |
| 105 ~StubOzoneDelegate() override {} | 103 ~StubOzoneDelegate() override {} |
| 106 | 104 |
| 107 void OnBoundsChanged(const gfx::Rect& new_bounds) override {} | 105 void OnBoundsChanged(const gfx::Rect& new_bounds) override {} |
| 108 | 106 |
| 109 void OnDamageRect(const gfx::Rect& damaged_region) override {} | 107 void OnDamageRect(const gfx::Rect& damaged_region) override {} |
| 110 | 108 |
| 111 void DispatchEvent(ui::Event* event) override {} | 109 void DispatchEvent(ui::Event* event) override {} |
| (...skipping 13 matching lines...) Expand all Loading... |
| 125 | 123 |
| 126 gfx::AcceleratedWidget accelerated_widget() const { | 124 gfx::AcceleratedWidget accelerated_widget() const { |
| 127 return accelerated_widget_; | 125 return accelerated_widget_; |
| 128 } | 126 } |
| 129 | 127 |
| 130 gfx::Size GetSize() { return platform_window_->GetBounds().size(); } | 128 gfx::Size GetSize() { return platform_window_->GetBounds().size(); } |
| 131 | 129 |
| 132 ui::PlatformWindow* platform_window() const { return platform_window_.get(); } | 130 ui::PlatformWindow* platform_window() const { return platform_window_.get(); } |
| 133 | 131 |
| 134 private: | 132 private: |
| 135 ui::UiThreadGpu ui_thread_gpu_; | |
| 136 scoped_ptr<ui::PlatformWindow> platform_window_; | 133 scoped_ptr<ui::PlatformWindow> platform_window_; |
| 137 gfx::AcceleratedWidget accelerated_widget_; | 134 gfx::AcceleratedWidget accelerated_widget_; |
| 138 | 135 |
| 139 DISALLOW_COPY_AND_ASSIGN(StubOzoneDelegate); | 136 DISALLOW_COPY_AND_ASSIGN(StubOzoneDelegate); |
| 140 }; | 137 }; |
| 141 | 138 |
| 142 #endif // defined(USE_OZONE) | 139 #endif // defined(USE_OZONE) |
| 143 | 140 |
| 144 RenderingHelperParams::RenderingHelperParams() | 141 RenderingHelperParams::RenderingHelperParams() |
| 145 : rendering_fps(0), warm_up_iterations(0), render_as_thumbnails(false) { | 142 : rendering_fps(0), warm_up_iterations(0), render_as_thumbnails(false) { |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 // When the rendering falls behind, drops frames. | 830 // When the rendering falls behind, drops frames. |
| 834 while (scheduled_render_time_ < target) { | 831 while (scheduled_render_time_ < target) { |
| 835 scheduled_render_time_ += frame_duration_; | 832 scheduled_render_time_ += frame_duration_; |
| 836 DropOneFrameForAllVideos(); | 833 DropOneFrameForAllVideos(); |
| 837 } | 834 } |
| 838 | 835 |
| 839 message_loop_->PostDelayedTask( | 836 message_loop_->PostDelayedTask( |
| 840 FROM_HERE, render_task_.callback(), target - now); | 837 FROM_HERE, render_task_.callback(), target - now); |
| 841 } | 838 } |
| 842 } // namespace content | 839 } // namespace content |
| OLD | NEW |