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

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

Issue 2480373002: Refactor context creation parameters into a struct. (Closed)
Patch Set: address piman's comments Created 4 years, 1 month 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 "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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 render_as_thumbnails_ = params.render_as_thumbnails; 343 render_as_thumbnails_ = params.render_as_thumbnails;
344 task_runner_ = base::ThreadTaskRunnerHandle::Get(); 344 task_runner_ = base::ThreadTaskRunnerHandle::Get();
345 345
346 gl_surface_ = gl::init::CreateViewGLSurface(window_); 346 gl_surface_ = gl::init::CreateViewGLSurface(window_);
347 #if defined(USE_OZONE) 347 #if defined(USE_OZONE)
348 gl_surface_->Resize(platform_window_delegate_->GetSize(), 1.f, true); 348 gl_surface_->Resize(platform_window_delegate_->GetSize(), 1.f, true);
349 #endif // defined(USE_OZONE) 349 #endif // defined(USE_OZONE)
350 screen_size_ = gl_surface_->GetSize(); 350 screen_size_ = gl_surface_->GetSize();
351 351
352 gl_context_ = gl::init::CreateGLContext(nullptr, gl_surface_.get(), 352 gl_context_ = gl::init::CreateGLContext(nullptr, gl_surface_.get(),
353 gl::PreferIntegratedGpu); 353 gl::GLContextAttribs());
354 CHECK(gl_context_->MakeCurrent(gl_surface_.get())); 354 CHECK(gl_context_->MakeCurrent(gl_surface_.get()));
355 355
356 CHECK_GT(params.window_sizes.size(), 0U); 356 CHECK_GT(params.window_sizes.size(), 0U);
357 videos_.resize(params.window_sizes.size()); 357 videos_.resize(params.window_sizes.size());
358 LayoutRenderingAreas(params.window_sizes); 358 LayoutRenderingAreas(params.window_sizes);
359 359
360 if (render_as_thumbnails_) { 360 if (render_as_thumbnails_) {
361 CHECK_EQ(videos_.size(), 1U); 361 CHECK_EQ(videos_.size(), 1U);
362 362
363 GLint max_texture_size; 363 GLint max_texture_size;
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 // When the rendering falls behind, drops frames. 884 // When the rendering falls behind, drops frames.
885 while (scheduled_render_time_ < target) { 885 while (scheduled_render_time_ < target) {
886 scheduled_render_time_ += frame_duration_; 886 scheduled_render_time_ += frame_duration_;
887 DropOneFrameForAllVideos(); 887 DropOneFrameForAllVideos();
888 } 888 }
889 889
890 task_runner_->PostDelayedTask(FROM_HERE, render_task_.callback(), 890 task_runner_->PostDelayedTask(FROM_HERE, render_task_.callback(),
891 target - now); 891 target - now);
892 } 892 }
893 } // namespace media 893 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698