Refactoring: use C++11 class member variable initialization
This commit is contained in:
parent
ee57c95aa6
commit
2337237d58
94 changed files with 218 additions and 377 deletions
|
@ -13,7 +13,7 @@ namespace atom {
|
|||
|
||||
OffScreenOutputDevice::OffScreenOutputDevice(bool transparent,
|
||||
const OnPaintCallback& callback)
|
||||
: transparent_(transparent), callback_(callback), active_(false) {
|
||||
: transparent_(transparent), callback_(callback) {
|
||||
DCHECK(!callback_.is_null());
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class OffScreenOutputDevice : public viz::SoftwareOutputDevice {
|
|||
const bool transparent_;
|
||||
OnPaintCallback callback_;
|
||||
|
||||
bool active_;
|
||||
bool active_ = false;
|
||||
|
||||
std::unique_ptr<SkCanvas> canvas_;
|
||||
std::unique_ptr<SkBitmap> bitmap_;
|
||||
|
|
|
@ -117,8 +117,6 @@ class AtomCopyFrameGenerator {
|
|||
AtomCopyFrameGenerator(OffScreenRenderWidgetHostView* view,
|
||||
int frame_rate_threshold_us)
|
||||
: view_(view),
|
||||
frame_retry_count_(0),
|
||||
next_frame_time_(base::TimeTicks::Now()),
|
||||
frame_duration_(
|
||||
base::TimeDelta::FromMicroseconds(frame_rate_threshold_us)),
|
||||
weak_ptr_factory_(this) {
|
||||
|
@ -204,8 +202,8 @@ class AtomCopyFrameGenerator {
|
|||
|
||||
base::Time last_time_;
|
||||
|
||||
int frame_retry_count_;
|
||||
base::TimeTicks next_frame_time_;
|
||||
int frame_retry_count_ = 0;
|
||||
base::TimeTicks next_frame_time_ = base::TimeTicks::Now();
|
||||
base::TimeDelta frame_duration_;
|
||||
|
||||
base::WeakPtrFactory<AtomCopyFrameGenerator> weak_ptr_factory_;
|
||||
|
@ -257,27 +255,14 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
|
|||
NativeWindow* native_window)
|
||||
: render_widget_host_(content::RenderWidgetHostImpl::From(host)),
|
||||
parent_host_view_(parent_host_view),
|
||||
popup_host_view_(nullptr),
|
||||
child_host_view_(nullptr),
|
||||
native_window_(native_window),
|
||||
software_output_device_(nullptr),
|
||||
transparent_(transparent),
|
||||
callback_(callback),
|
||||
parent_callback_(nullptr),
|
||||
frame_rate_(frame_rate),
|
||||
frame_rate_threshold_us_(0),
|
||||
last_time_(base::Time::Now()),
|
||||
scale_factor_(kDefaultScaleFactor),
|
||||
size_(native_window->GetSize()),
|
||||
painting_(painting),
|
||||
is_showing_(!render_widget_host_->is_hidden()),
|
||||
is_destroyed_(false),
|
||||
popup_position_(gfx::Rect()),
|
||||
hold_resize_(false),
|
||||
pending_resize_(false),
|
||||
paint_callback_running_(false),
|
||||
renderer_compositor_frame_sink_(nullptr),
|
||||
background_color_(SkColor()),
|
||||
weak_ptr_factory_(this) {
|
||||
DCHECK(render_widget_host_);
|
||||
bool is_guest_view_hack = parent_host_view_ != nullptr;
|
||||
|
|
|
@ -285,38 +285,38 @@ class OffScreenRenderWidgetHostView
|
|||
// Weak ptrs.
|
||||
content::RenderWidgetHostImpl* render_widget_host_;
|
||||
|
||||
OffScreenRenderWidgetHostView* parent_host_view_;
|
||||
OffScreenRenderWidgetHostView* popup_host_view_;
|
||||
OffScreenRenderWidgetHostView* parent_host_view_ = nullptr;
|
||||
OffScreenRenderWidgetHostView* popup_host_view_ = nullptr;
|
||||
std::unique_ptr<SkBitmap> popup_bitmap_;
|
||||
OffScreenRenderWidgetHostView* child_host_view_;
|
||||
OffScreenRenderWidgetHostView* child_host_view_ = nullptr;
|
||||
std::set<OffScreenRenderWidgetHostView*> guest_host_views_;
|
||||
std::set<OffscreenViewProxy*> proxy_views_;
|
||||
|
||||
NativeWindow* native_window_;
|
||||
OffScreenOutputDevice* software_output_device_;
|
||||
OffScreenOutputDevice* software_output_device_ = nullptr;
|
||||
|
||||
const bool transparent_;
|
||||
OnPaintCallback callback_;
|
||||
OnPaintCallback parent_callback_;
|
||||
|
||||
int frame_rate_;
|
||||
int frame_rate_threshold_us_;
|
||||
int frame_rate_ = 0;
|
||||
int frame_rate_threshold_us_ = 0;
|
||||
|
||||
base::Time last_time_;
|
||||
base::Time last_time_ = base::Time::Now();
|
||||
|
||||
float scale_factor_;
|
||||
gfx::Vector2dF last_scroll_offset_;
|
||||
gfx::Size size_;
|
||||
bool painting_;
|
||||
|
||||
bool is_showing_;
|
||||
bool is_destroyed_;
|
||||
bool is_showing_ = false;
|
||||
bool is_destroyed_ = false;
|
||||
gfx::Rect popup_position_;
|
||||
|
||||
bool hold_resize_;
|
||||
bool pending_resize_;
|
||||
bool hold_resize_ = false;
|
||||
bool pending_resize_ = false;
|
||||
|
||||
bool paint_callback_running_;
|
||||
bool paint_callback_running_ = false;
|
||||
|
||||
viz::LocalSurfaceId local_surface_id_;
|
||||
viz::LocalSurfaceIdAllocator local_surface_id_allocator_;
|
||||
|
@ -344,9 +344,10 @@ class OffScreenRenderWidgetHostView
|
|||
std::string selected_text_;
|
||||
#endif
|
||||
|
||||
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink_;
|
||||
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink_ =
|
||||
nullptr;
|
||||
|
||||
SkColor background_color_;
|
||||
SkColor background_color_ = SkColor();
|
||||
|
||||
base::WeakPtrFactory<OffScreenRenderWidgetHostView> weak_ptr_factory_;
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
|
||||
namespace atom {
|
||||
|
||||
OffscreenViewProxy::OffscreenViewProxy(views::View* view)
|
||||
: view_(view), observer_(nullptr) {
|
||||
OffscreenViewProxy::OffscreenViewProxy(views::View* view) : view_(view) {
|
||||
view_bitmap_.reset(new SkBitmap);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class OffscreenViewProxy {
|
|||
gfx::Rect view_bounds_;
|
||||
std::unique_ptr<SkBitmap> view_bitmap_;
|
||||
|
||||
OffscreenViewProxyObserver* observer_;
|
||||
OffscreenViewProxyObserver* observer_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -15,11 +15,7 @@ namespace atom {
|
|||
OffScreenWebContentsView::OffScreenWebContentsView(
|
||||
bool transparent,
|
||||
const OnPaintCallback& callback)
|
||||
: transparent_(transparent),
|
||||
painting_(true),
|
||||
frame_rate_(60),
|
||||
callback_(callback),
|
||||
web_contents_(nullptr) {
|
||||
: transparent_(transparent), callback_(callback) {
|
||||
#if defined(OS_MACOSX)
|
||||
PlatformCreate();
|
||||
#endif
|
||||
|
|
|
@ -83,12 +83,12 @@ class OffScreenWebContentsView : public content::WebContentsView,
|
|||
OffScreenRenderWidgetHostView* GetView() const;
|
||||
|
||||
const bool transparent_;
|
||||
bool painting_;
|
||||
int frame_rate_;
|
||||
bool painting_ = true;
|
||||
int frame_rate_ = 60;
|
||||
OnPaintCallback callback_;
|
||||
|
||||
// Weak refs.
|
||||
content::WebContents* web_contents_;
|
||||
content::WebContents* web_contents_ = nullptr;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
OffScreenView* offScreenView_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue