| 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 <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <numeric> | 10 #include <numeric> |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 DISALLOW_COPY_AND_ASSIGN(StubOzoneDelegate); | 154 DISALLOW_COPY_AND_ASSIGN(StubOzoneDelegate); |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 #endif // defined(USE_OZONE) | 157 #endif // defined(USE_OZONE) |
| 158 | 158 |
| 159 RenderingHelperParams::RenderingHelperParams() | 159 RenderingHelperParams::RenderingHelperParams() |
| 160 : rendering_fps(0), warm_up_iterations(0), render_as_thumbnails(false) { | 160 : rendering_fps(0), warm_up_iterations(0), render_as_thumbnails(false) { |
| 161 } | 161 } |
| 162 | 162 |
| 163 RenderingHelperParams::RenderingHelperParams( |
| 164 const RenderingHelperParams& other) = default; |
| 165 |
| 163 RenderingHelperParams::~RenderingHelperParams() {} | 166 RenderingHelperParams::~RenderingHelperParams() {} |
| 164 | 167 |
| 165 VideoFrameTexture::VideoFrameTexture(uint32_t texture_target, | 168 VideoFrameTexture::VideoFrameTexture(uint32_t texture_target, |
| 166 uint32_t texture_id, | 169 uint32_t texture_id, |
| 167 const base::Closure& no_longer_needed_cb) | 170 const base::Closure& no_longer_needed_cb) |
| 168 : texture_target_(texture_target), | 171 : texture_target_(texture_target), |
| 169 texture_id_(texture_id), | 172 texture_id_(texture_id), |
| 170 no_longer_needed_cb_(no_longer_needed_cb) { | 173 no_longer_needed_cb_(no_longer_needed_cb) { |
| 171 DCHECK(!no_longer_needed_cb_.is_null()); | 174 DCHECK(!no_longer_needed_cb_.is_null()); |
| 172 } | 175 } |
| 173 | 176 |
| 174 VideoFrameTexture::~VideoFrameTexture() { | 177 VideoFrameTexture::~VideoFrameTexture() { |
| 175 base::ResetAndReturn(&no_longer_needed_cb_).Run(); | 178 base::ResetAndReturn(&no_longer_needed_cb_).Run(); |
| 176 } | 179 } |
| 177 | 180 |
| 178 RenderingHelper::RenderedVideo::RenderedVideo() | 181 RenderingHelper::RenderedVideo::RenderedVideo() |
| 179 : is_flushing(false), frames_to_drop(0) { | 182 : is_flushing(false), frames_to_drop(0) { |
| 180 } | 183 } |
| 181 | 184 |
| 185 RenderingHelper::RenderedVideo::RenderedVideo(const RenderedVideo& other) = |
| 186 default; |
| 187 |
| 182 RenderingHelper::RenderedVideo::~RenderedVideo() { | 188 RenderingHelper::RenderedVideo::~RenderedVideo() { |
| 183 } | 189 } |
| 184 | 190 |
| 185 // static | 191 // static |
| 186 void RenderingHelper::InitializeOneOff(base::WaitableEvent* done) { | 192 void RenderingHelper::InitializeOneOff(base::WaitableEvent* done) { |
| 187 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 193 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 188 #if GL_VARIANT_GLX | 194 #if GL_VARIANT_GLX |
| 189 cmd_line->AppendSwitchASCII(switches::kUseGL, | 195 cmd_line->AppendSwitchASCII(switches::kUseGL, |
| 190 gfx::kGLImplementationDesktopName); | 196 gfx::kGLImplementationDesktopName); |
| 191 #else | 197 #else |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 // When the rendering falls behind, drops frames. | 891 // When the rendering falls behind, drops frames. |
| 886 while (scheduled_render_time_ < target) { | 892 while (scheduled_render_time_ < target) { |
| 887 scheduled_render_time_ += frame_duration_; | 893 scheduled_render_time_ += frame_duration_; |
| 888 DropOneFrameForAllVideos(); | 894 DropOneFrameForAllVideos(); |
| 889 } | 895 } |
| 890 | 896 |
| 891 message_loop_->PostDelayedTask( | 897 message_loop_->PostDelayedTask( |
| 892 FROM_HERE, render_task_.callback(), target - now); | 898 FROM_HERE, render_task_.callback(), target - now); |
| 893 } | 899 } |
| 894 } // namespace content | 900 } // namespace content |
| OLD | NEW |