summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormohan.reddy <mohan.reddy@samsung.com>2014-09-12 12:43:32 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-12 19:48:11 +0000
commiteef1b5914f37b0fb0edbd1c340a60332d5453453 (patch)
treeafdabfca5fa78a22c28a9d71da91be76a114154f
parent802fbf73dba0b4f09f96640452d49de768c43cc0 (diff)
downloadchromium_src-eef1b5914f37b0fb0edbd1c340a60332d5453453.zip
chromium_src-eef1b5914f37b0fb0edbd1c340a60332d5453453.tar.gz
chromium_src-eef1b5914f37b0fb0edbd1c340a60332d5453453.tar.bz2
Refactoring the weak_ptr_factory order in content/browser/renderer_host
Changing in the intialization order of WeakPtrFactory such that all member variables should appear before the WeakPtrFactory to ensure that any WeakPtrs to Controller are invalidated before its members variable's destructors are executed, rendering them invalid. BUG=303818 Review URL: https://codereview.chromium.org/567923002 Cr-Commit-Position: refs/heads/master@{#294637}
-rw-r--r--content/browser/renderer_host/compositor_resize_lock_aura.cc4
-rw-r--r--content/browser/renderer_host/compositor_resize_lock_aura.h3
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc4
-rw-r--r--content/browser/renderer_host/render_view_host_impl.h4
-rw-r--r--content/browser/renderer_host/render_widget_host_view_android.cc4
-rw-r--r--content/browser/renderer_host/render_widget_host_view_android.h3
-rw-r--r--content/browser/renderer_host/socket_stream_dispatcher_host.cc4
-rw-r--r--content/browser/renderer_host/socket_stream_dispatcher_host.h3
8 files changed, 16 insertions, 13 deletions
diff --git a/content/browser/renderer_host/compositor_resize_lock_aura.cc b/content/browser/renderer_host/compositor_resize_lock_aura.cc
index 419b7b3..9d5b7d8 100644
--- a/content/browser/renderer_host/compositor_resize_lock_aura.cc
+++ b/content/browser/renderer_host/compositor_resize_lock_aura.cc
@@ -19,8 +19,8 @@ CompositorResizeLock::CompositorResizeLock(
const base::TimeDelta& timeout)
: ResizeLock(new_size, defer_compositor_lock),
host_(host),
- weak_ptr_factory_(this),
- cancelled_(false) {
+ cancelled_(false),
+ weak_ptr_factory_(this) {
DCHECK(host_);
TRACE_EVENT_ASYNC_BEGIN2("ui", "CompositorResizeLock", this,
diff --git a/content/browser/renderer_host/compositor_resize_lock_aura.h b/content/browser/renderer_host/compositor_resize_lock_aura.h
index 1c2be39..70595f9 100644
--- a/content/browser/renderer_host/compositor_resize_lock_aura.h
+++ b/content/browser/renderer_host/compositor_resize_lock_aura.h
@@ -38,9 +38,10 @@ class CompositorResizeLock : public ResizeLock {
private:
aura::WindowTreeHost* host_;
scoped_refptr<ui::CompositorLock> compositor_lock_;
- base::WeakPtrFactory<CompositorResizeLock> weak_ptr_factory_;
bool cancelled_;
+ base::WeakPtrFactory<CompositorResizeLock> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(CompositorResizeLock);
};
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 42707c47..8f497f7 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -193,9 +193,9 @@ RenderViewHostImpl::RenderViewHostImpl(
sudden_termination_allowed_(false),
render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
virtual_keyboard_requested_(false),
- weak_factory_(this),
is_focused_element_editable_(false),
- updating_web_preferences_(false) {
+ updating_web_preferences_(false),
+ weak_factory_(this) {
DCHECK(instance_.get());
CHECK(delegate_); // http://crbug.com/82827
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
index 954046b..3b99678 100644
--- a/content/browser/renderer_host/render_view_host_impl.h
+++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -526,8 +526,6 @@ class CONTENT_EXPORT RenderViewHostImpl
// TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
base::Closure pending_shutdown_on_swap_out_;
- base::WeakPtrFactory<RenderViewHostImpl> weak_factory_;
-
// True if the current focused element is editable.
bool is_focused_element_editable_;
@@ -538,6 +536,8 @@ class CONTENT_EXPORT RenderViewHostImpl
bool updating_web_preferences_;
+ base::WeakPtrFactory<RenderViewHostImpl> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl);
};
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index e7a0cb2..9ccfa6c 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -273,7 +273,6 @@ RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
ime_adapter_android_(this),
cached_background_color_(SK_ColorWHITE),
last_output_surface_id_(kUndefinedOutputSurfaceId),
- weak_ptr_factory_(this),
overscroll_effect_enabled_(
!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableOverscrollEdgeEffect)),
@@ -287,7 +286,8 @@ RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
widget_host->GetRoutingID()) != NULL),
frame_evictor_(new DelegatedFrameEvictor(this)),
locks_on_frame_count_(0),
- observing_root_window_(false) {
+ observing_root_window_(false),
+ weak_ptr_factory_(this) {
host_->SetView(this);
SetContentViewCore(content_view_core);
ImageTransportFactoryAndroid::AddObserver(this);
diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h
index c41252d..c7ec65a 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.h
+++ b/content/browser/renderer_host/render_widget_host_view_android.h
@@ -383,7 +383,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid
// The output surface id of the last received frame.
uint32_t last_output_surface_id_;
- base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_;
std::queue<base::Closure> ack_callbacks_;
@@ -434,6 +433,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid
// The last scroll offset of the view.
gfx::Vector2dF last_scroll_offset_;
+ base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid);
};
diff --git a/content/browser/renderer_host/socket_stream_dispatcher_host.cc b/content/browser/renderer_host/socket_stream_dispatcher_host.cc
index c52023e..5cd1d94 100644
--- a/content/browser/renderer_host/socket_stream_dispatcher_host.cc
+++ b/content/browser/renderer_host/socket_stream_dispatcher_host.cc
@@ -36,8 +36,8 @@ SocketStreamDispatcherHost::SocketStreamDispatcherHost(
render_process_id_(render_process_id),
request_context_callback_(request_context_callback),
resource_context_(resource_context),
- weak_ptr_factory_(this),
- on_shutdown_(false) {
+ on_shutdown_(false),
+ weak_ptr_factory_(this) {
net::WebSocketJob::EnsureInit();
}
diff --git a/content/browser/renderer_host/socket_stream_dispatcher_host.h b/content/browser/renderer_host/socket_stream_dispatcher_host.h
index bc0e35f..d5e988a 100644
--- a/content/browser/renderer_host/socket_stream_dispatcher_host.h
+++ b/content/browser/renderer_host/socket_stream_dispatcher_host.h
@@ -88,9 +88,10 @@ class SocketStreamDispatcherHost
GetRequestContextCallback request_context_callback_;
ResourceContext* resource_context_;
- base::WeakPtrFactory<SocketStreamDispatcherHost> weak_ptr_factory_;
bool on_shutdown_;
+ base::WeakPtrFactory<SocketStreamDispatcherHost> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcherHost);
};