From c45d9555e789245879b0d33f5bdc9fa8dab312b6 Mon Sep 17 00:00:00 2001 From: gellert Date: Wed, 27 Jul 2016 20:31:03 +0200 Subject: [PATCH] cleans up class names --- atom/browser/osr_window.cc | 42 ++++++++++++++------------------------ atom/browser/osr_window.h | 8 ++++---- 2 files changed, 19 insertions(+), 31 deletions(-) diff --git a/atom/browser/osr_window.cc b/atom/browser/osr_window.cc index bef3b65edba6..1819816f4ac0 100644 --- a/atom/browser/osr_window.cc +++ b/atom/browser/osr_window.cc @@ -57,12 +57,9 @@ const int kFrameRetryLimit = 2; namespace atom { -// Used for managing copy requests when GPU compositing is enabled. Based on -// RendererOverridesHandler::InnerSwapCompositorFrame and -// DelegatedFrameHost::CopyFromCompositingSurface. -class CefCopyFrameGenerator { +class AtomCopyFrameGenerator { public: - CefCopyFrameGenerator(int frame_rate_threshold_ms, + AtomCopyFrameGenerator(int frame_rate_threshold_ms, OffScreenWindow* view) : frame_rate_threshold_ms_(frame_rate_threshold_ms), view_(view), @@ -89,7 +86,6 @@ class CefCopyFrameGenerator { // Don't attempt to generate a frame while one is currently in-progress. if (frame_in_progress_) { - // std::cout << "FRAME IN PROGRESS" << std::endl; return; } frame_in_progress_ = true; @@ -100,7 +96,7 @@ class CefCopyFrameGenerator { if (frame_rate_delta < frame_rate_threshold_ms_) { // Generate the frame after the necessary time has passed. CEF_POST_DELAYED_TASK(CEF_UIT, - base::Bind(&CefCopyFrameGenerator::InternalGenerateCopyFrame, + base::Bind(&AtomCopyFrameGenerator::InternalGenerateCopyFrame, weak_ptr_factory_.GetWeakPtr()), frame_rate_threshold_ms_ - frame_rate_delta); return; @@ -131,7 +127,7 @@ class CefCopyFrameGenerator { // SkBitmap in the GPU codepath and avoid scaling where possible. std::unique_ptr request = cc::CopyOutputRequest::CreateRequest(base::Bind( - &CefCopyFrameGenerator::CopyFromCompositingSurfaceHasResult, + &AtomCopyFrameGenerator::CopyFromCompositingSurfaceHasResult, weak_ptr_factory_.GetWeakPtr(), damage_rect)); @@ -165,7 +161,7 @@ class CefCopyFrameGenerator { std::unique_ptr result) { DCHECK(result->HasTexture()); base::ScopedClosureRunner scoped_callback_runner( - base::Bind(&CefCopyFrameGenerator::OnCopyFrameCaptureFailure, + base::Bind(&AtomCopyFrameGenerator::OnCopyFrameCaptureFailure, weak_ptr_factory_.GetWeakPtr(), damage_rect)); @@ -205,14 +201,6 @@ class CefCopyFrameGenerator { ignore_result(scoped_callback_runner.Release()); - // base::Time now = base::Time::Now(); - // std::cout << "delta: " << (now - last_time_).InMilliseconds() << " ms" << std::endl; - // last_time_ = now; - // frame_in_progress_ = false; - // if (view_->paintCallback) { - // view_->paintCallback->Run(damage_rect, bitmap_->width(), bitmap_->height(), - // pixels); - // } gl_helper->CropScaleReadbackAndCleanMailbox( texture_mailbox.mailbox(), texture_mailbox.sync_token(), @@ -222,7 +210,7 @@ class CefCopyFrameGenerator { pixels, kN32_SkColorType, base::Bind( - &CefCopyFrameGenerator::CopyFromCompositingSurfaceFinishedProxy, + &AtomCopyFrameGenerator::CopyFromCompositingSurfaceFinishedProxy, weak_ptr_factory_.GetWeakPtr(), base::Passed(&release_callback), damage_rect, @@ -232,7 +220,7 @@ class CefCopyFrameGenerator { } static void CopyFromCompositingSurfaceFinishedProxy( - base::WeakPtr generator, + base::WeakPtr generator, std::unique_ptr release_callback, const gfx::Rect& damage_rect, std::unique_ptr bitmap, @@ -325,7 +313,7 @@ class CefCopyFrameGenerator { // Another frame was requested while the current frame was in-progress. // Generate the pending frame now. CEF_POST_TASK(CEF_UIT, - base::Bind(&CefCopyFrameGenerator::GenerateCopyFrame, + base::Bind(&AtomCopyFrameGenerator::GenerateCopyFrame, weak_ptr_factory_.GetWeakPtr(), force_frame, gfx::Rect())); @@ -344,16 +332,16 @@ class CefCopyFrameGenerator { std::unique_ptr bitmap_; gfx::Rect pending_damage_rect_; - base::WeakPtrFactory weak_ptr_factory_; + base::WeakPtrFactory weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(CefCopyFrameGenerator); + DISALLOW_COPY_AND_ASSIGN(AtomCopyFrameGenerator); }; // Used to control the VSync rate in subprocesses when BeginFrame scheduling is // enabled. -class CefBeginFrameTimer : public cc::DelayBasedTimeSourceClient { +class AtomBeginFrameTimer : public cc::DelayBasedTimeSourceClient { public: - CefBeginFrameTimer(int frame_rate_threshold_ms, + AtomBeginFrameTimer(int frame_rate_threshold_ms, const base::Closure& callback) : callback_(callback) { time_source_ = cc::DelayBasedTimeSource::Create( @@ -385,7 +373,7 @@ class CefBeginFrameTimer : public cc::DelayBasedTimeSourceClient { const base::Closure callback_; std::unique_ptr time_source_; - DISALLOW_COPY_AND_ASSIGN(CefBeginFrameTimer); + DISALLOW_COPY_AND_ASSIGN(AtomBeginFrameTimer); }; OffScreenWindow::OffScreenWindow( @@ -648,7 +636,7 @@ void OffScreenWindow::OnSwapCompositorFrame( } else { if (!copy_frame_generator_.get()) { copy_frame_generator_.reset( - new CefCopyFrameGenerator(frame_rate_threshold_ms_, this)); + new AtomCopyFrameGenerator(frame_rate_threshold_ms_, this)); } cc::RenderPass* root_pass = @@ -915,7 +903,7 @@ void OffScreenWindow::SetFrameRate() { if (begin_frame_timer_.get()) { begin_frame_timer_->SetFrameRateThresholdMs(frame_rate_threshold_ms_); } else { - begin_frame_timer_.reset(new CefBeginFrameTimer( + begin_frame_timer_.reset(new AtomBeginFrameTimer( frame_rate_threshold_ms_, base::Bind(&OffScreenWindow::OnBeginFrameTimerTick, weak_ptr_factory_.GetWeakPtr()))); diff --git a/atom/browser/osr_window.h b/atom/browser/osr_window.h index 87265d470a82..0ad2cf340e8d 100644 --- a/atom/browser/osr_window.h +++ b/atom/browser/osr_window.h @@ -54,8 +54,8 @@ class NSTextInputContext; namespace atom { -class CefCopyFrameGenerator; -class CefBeginFrameTimer; +class AtomCopyFrameGenerator; +class AtomBeginFrameTimer; class OffScreenWindow : public content::RenderWidgetHostViewBase, @@ -202,8 +202,8 @@ private: content::RenderWidgetHostImpl* render_widget_host_; NativeWindow* native_window_; - std::unique_ptr copy_frame_generator_; - std::unique_ptr begin_frame_timer_; + std::unique_ptr copy_frame_generator_; + std::unique_ptr begin_frame_timer_; OffScreenOutputDevice* software_output_device_;