refactor: use C++11 class member variable initialization (#27477)

This commit is contained in:
Milan Burda
2021-01-26 19:16:21 +01:00
committed by GitHub
parent f083380c38
commit ddf3ef0a5f
93 changed files with 130 additions and 163 deletions

View File

@@ -182,11 +182,9 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
frame_rate_(frame_rate),
size_(initial_size),
painting_(painting),
is_showing_(false),
cursor_manager_(new content::CursorManager(this)),
mouse_wheel_phase_handler_(this),
backing_(new SkBitmap),
weak_ptr_factory_(this) {
backing_(new SkBitmap) {
DCHECK(render_widget_host_);
DCHECK(!render_widget_host_->GetView());

View File

@@ -280,7 +280,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
std::unique_ptr<SkBitmap> backing_;
base::WeakPtrFactory<OffScreenRenderWidgetHostView> weak_ptr_factory_;
base::WeakPtrFactory<OffScreenRenderWidgetHostView> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(OffScreenRenderWidgetHostView);
};

View File

@@ -18,8 +18,7 @@ OffScreenVideoConsumer::OffScreenVideoConsumer(
OnPaintCallback callback)
: callback_(callback),
view_(view),
video_capturer_(view->CreateVideoCapturer()),
weak_ptr_factory_(this) {
video_capturer_(view->CreateVideoCapturer()) {
video_capturer_->SetResolutionConstraints(view_->SizeInPixels(),
view_->SizeInPixels(), true);
video_capturer_->SetAutoThrottlingEnabled(false);

View File

@@ -48,7 +48,7 @@ class OffScreenVideoConsumer : public viz::mojom::FrameSinkVideoConsumer {
OffScreenRenderWidgetHostView* view_;
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
base::WeakPtrFactory<OffScreenVideoConsumer> weak_ptr_factory_;
base::WeakPtrFactory<OffScreenVideoConsumer> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(OffScreenVideoConsumer);
};

View File

@@ -14,7 +14,7 @@ namespace electron {
OffScreenWebContentsView::OffScreenWebContentsView(
bool transparent,
const OnPaintCallback& callback)
: native_window_(nullptr), transparent_(transparent), callback_(callback) {
: transparent_(transparent), callback_(callback) {
#if defined(OS_MAC)
PlatformCreate();
#endif

View File

@@ -88,7 +88,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
OffScreenRenderWidgetHostView* GetView() const;
NativeWindow* native_window_;
NativeWindow* native_window_ = nullptr;
const bool transparent_;
bool painting_ = true;