cleans up class names

This commit is contained in:
gellert 2016-07-27 20:31:03 +02:00
parent f90e62a7a5
commit c45d9555e7
2 changed files with 19 additions and 31 deletions

View file

@ -57,12 +57,9 @@ const int kFrameRetryLimit = 2;
namespace atom { namespace atom {
// Used for managing copy requests when GPU compositing is enabled. Based on class AtomCopyFrameGenerator {
// RendererOverridesHandler::InnerSwapCompositorFrame and
// DelegatedFrameHost::CopyFromCompositingSurface.
class CefCopyFrameGenerator {
public: public:
CefCopyFrameGenerator(int frame_rate_threshold_ms, AtomCopyFrameGenerator(int frame_rate_threshold_ms,
OffScreenWindow* view) OffScreenWindow* view)
: frame_rate_threshold_ms_(frame_rate_threshold_ms), : frame_rate_threshold_ms_(frame_rate_threshold_ms),
view_(view), view_(view),
@ -89,7 +86,6 @@ class CefCopyFrameGenerator {
// Don't attempt to generate a frame while one is currently in-progress. // Don't attempt to generate a frame while one is currently in-progress.
if (frame_in_progress_) { if (frame_in_progress_) {
// std::cout << "FRAME IN PROGRESS" << std::endl;
return; return;
} }
frame_in_progress_ = true; frame_in_progress_ = true;
@ -100,7 +96,7 @@ class CefCopyFrameGenerator {
if (frame_rate_delta < frame_rate_threshold_ms_) { if (frame_rate_delta < frame_rate_threshold_ms_) {
// Generate the frame after the necessary time has passed. // Generate the frame after the necessary time has passed.
CEF_POST_DELAYED_TASK(CEF_UIT, CEF_POST_DELAYED_TASK(CEF_UIT,
base::Bind(&CefCopyFrameGenerator::InternalGenerateCopyFrame, base::Bind(&AtomCopyFrameGenerator::InternalGenerateCopyFrame,
weak_ptr_factory_.GetWeakPtr()), weak_ptr_factory_.GetWeakPtr()),
frame_rate_threshold_ms_ - frame_rate_delta); frame_rate_threshold_ms_ - frame_rate_delta);
return; return;
@ -131,7 +127,7 @@ class CefCopyFrameGenerator {
// SkBitmap in the GPU codepath and avoid scaling where possible. // SkBitmap in the GPU codepath and avoid scaling where possible.
std::unique_ptr<cc::CopyOutputRequest> request = std::unique_ptr<cc::CopyOutputRequest> request =
cc::CopyOutputRequest::CreateRequest(base::Bind( cc::CopyOutputRequest::CreateRequest(base::Bind(
&CefCopyFrameGenerator::CopyFromCompositingSurfaceHasResult, &AtomCopyFrameGenerator::CopyFromCompositingSurfaceHasResult,
weak_ptr_factory_.GetWeakPtr(), weak_ptr_factory_.GetWeakPtr(),
damage_rect)); damage_rect));
@ -165,7 +161,7 @@ class CefCopyFrameGenerator {
std::unique_ptr<cc::CopyOutputResult> result) { std::unique_ptr<cc::CopyOutputResult> result) {
DCHECK(result->HasTexture()); DCHECK(result->HasTexture());
base::ScopedClosureRunner scoped_callback_runner( base::ScopedClosureRunner scoped_callback_runner(
base::Bind(&CefCopyFrameGenerator::OnCopyFrameCaptureFailure, base::Bind(&AtomCopyFrameGenerator::OnCopyFrameCaptureFailure,
weak_ptr_factory_.GetWeakPtr(), weak_ptr_factory_.GetWeakPtr(),
damage_rect)); damage_rect));
@ -205,14 +201,6 @@ class CefCopyFrameGenerator {
ignore_result(scoped_callback_runner.Release()); 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( gl_helper->CropScaleReadbackAndCleanMailbox(
texture_mailbox.mailbox(), texture_mailbox.mailbox(),
texture_mailbox.sync_token(), texture_mailbox.sync_token(),
@ -222,7 +210,7 @@ class CefCopyFrameGenerator {
pixels, pixels,
kN32_SkColorType, kN32_SkColorType,
base::Bind( base::Bind(
&CefCopyFrameGenerator::CopyFromCompositingSurfaceFinishedProxy, &AtomCopyFrameGenerator::CopyFromCompositingSurfaceFinishedProxy,
weak_ptr_factory_.GetWeakPtr(), weak_ptr_factory_.GetWeakPtr(),
base::Passed(&release_callback), base::Passed(&release_callback),
damage_rect, damage_rect,
@ -232,7 +220,7 @@ class CefCopyFrameGenerator {
} }
static void CopyFromCompositingSurfaceFinishedProxy( static void CopyFromCompositingSurfaceFinishedProxy(
base::WeakPtr<CefCopyFrameGenerator> generator, base::WeakPtr<AtomCopyFrameGenerator> generator,
std::unique_ptr<cc::SingleReleaseCallback> release_callback, std::unique_ptr<cc::SingleReleaseCallback> release_callback,
const gfx::Rect& damage_rect, const gfx::Rect& damage_rect,
std::unique_ptr<SkBitmap> bitmap, std::unique_ptr<SkBitmap> bitmap,
@ -325,7 +313,7 @@ class CefCopyFrameGenerator {
// Another frame was requested while the current frame was in-progress. // Another frame was requested while the current frame was in-progress.
// Generate the pending frame now. // Generate the pending frame now.
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
base::Bind(&CefCopyFrameGenerator::GenerateCopyFrame, base::Bind(&AtomCopyFrameGenerator::GenerateCopyFrame,
weak_ptr_factory_.GetWeakPtr(), weak_ptr_factory_.GetWeakPtr(),
force_frame, force_frame,
gfx::Rect())); gfx::Rect()));
@ -344,16 +332,16 @@ class CefCopyFrameGenerator {
std::unique_ptr<SkBitmap> bitmap_; std::unique_ptr<SkBitmap> bitmap_;
gfx::Rect pending_damage_rect_; gfx::Rect pending_damage_rect_;
base::WeakPtrFactory<CefCopyFrameGenerator> weak_ptr_factory_; base::WeakPtrFactory<AtomCopyFrameGenerator> 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 // Used to control the VSync rate in subprocesses when BeginFrame scheduling is
// enabled. // enabled.
class CefBeginFrameTimer : public cc::DelayBasedTimeSourceClient { class AtomBeginFrameTimer : public cc::DelayBasedTimeSourceClient {
public: public:
CefBeginFrameTimer(int frame_rate_threshold_ms, AtomBeginFrameTimer(int frame_rate_threshold_ms,
const base::Closure& callback) const base::Closure& callback)
: callback_(callback) { : callback_(callback) {
time_source_ = cc::DelayBasedTimeSource::Create( time_source_ = cc::DelayBasedTimeSource::Create(
@ -385,7 +373,7 @@ class CefBeginFrameTimer : public cc::DelayBasedTimeSourceClient {
const base::Closure callback_; const base::Closure callback_;
std::unique_ptr<cc::DelayBasedTimeSource> time_source_; std::unique_ptr<cc::DelayBasedTimeSource> time_source_;
DISALLOW_COPY_AND_ASSIGN(CefBeginFrameTimer); DISALLOW_COPY_AND_ASSIGN(AtomBeginFrameTimer);
}; };
OffScreenWindow::OffScreenWindow( OffScreenWindow::OffScreenWindow(
@ -648,7 +636,7 @@ void OffScreenWindow::OnSwapCompositorFrame(
} else { } else {
if (!copy_frame_generator_.get()) { if (!copy_frame_generator_.get()) {
copy_frame_generator_.reset( copy_frame_generator_.reset(
new CefCopyFrameGenerator(frame_rate_threshold_ms_, this)); new AtomCopyFrameGenerator(frame_rate_threshold_ms_, this));
} }
cc::RenderPass* root_pass = cc::RenderPass* root_pass =
@ -915,7 +903,7 @@ void OffScreenWindow::SetFrameRate() {
if (begin_frame_timer_.get()) { if (begin_frame_timer_.get()) {
begin_frame_timer_->SetFrameRateThresholdMs(frame_rate_threshold_ms_); begin_frame_timer_->SetFrameRateThresholdMs(frame_rate_threshold_ms_);
} else { } else {
begin_frame_timer_.reset(new CefBeginFrameTimer( begin_frame_timer_.reset(new AtomBeginFrameTimer(
frame_rate_threshold_ms_, frame_rate_threshold_ms_,
base::Bind(&OffScreenWindow::OnBeginFrameTimerTick, base::Bind(&OffScreenWindow::OnBeginFrameTimerTick,
weak_ptr_factory_.GetWeakPtr()))); weak_ptr_factory_.GetWeakPtr())));

View file

@ -54,8 +54,8 @@ class NSTextInputContext;
namespace atom { namespace atom {
class CefCopyFrameGenerator; class AtomCopyFrameGenerator;
class CefBeginFrameTimer; class AtomBeginFrameTimer;
class OffScreenWindow class OffScreenWindow
: public content::RenderWidgetHostViewBase, : public content::RenderWidgetHostViewBase,
@ -202,8 +202,8 @@ private:
content::RenderWidgetHostImpl* render_widget_host_; content::RenderWidgetHostImpl* render_widget_host_;
NativeWindow* native_window_; NativeWindow* native_window_;
std::unique_ptr<CefCopyFrameGenerator> copy_frame_generator_; std::unique_ptr<AtomCopyFrameGenerator> copy_frame_generator_;
std::unique_ptr<CefBeginFrameTimer> begin_frame_timer_; std::unique_ptr<AtomBeginFrameTimer> begin_frame_timer_;
OffScreenOutputDevice* software_output_device_; OffScreenOutputDevice* software_output_device_;