Fix WeakPtrFactory member ordering in content
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/737353003 Cr-Commit-Position: refs/heads/master@{#305234}
This commit is contained in:
content
browser
renderer_host
web_contents
renderer
@ -1279,9 +1279,8 @@ void RenderWidgetHostViewAura::ShowDisambiguationPopup(
|
||||
disambiguation_target_rect_,
|
||||
zoomed_size,
|
||||
base::Bind(&RenderWidgetHostViewAura::DisambiguationPopupRendered,
|
||||
base::internal::SupportsWeakPtrBase::StaticAsWeakPtr
|
||||
<RenderWidgetHostViewAura>(this)),
|
||||
kN32_SkColorType);
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
kN32_SkColorType);
|
||||
}
|
||||
|
||||
void RenderWidgetHostViewAura::DisambiguationPopupRendered(
|
||||
@ -1307,11 +1306,9 @@ void RenderWidgetHostViewAura::DisambiguationPopupRendered(
|
||||
disambiguation_target_rect_,
|
||||
result,
|
||||
base::Bind(&RenderWidgetHostViewAura::ProcessDisambiguationGesture,
|
||||
base::internal::SupportsWeakPtrBase::StaticAsWeakPtr
|
||||
<RenderWidgetHostViewAura>(this)),
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
base::Bind(&RenderWidgetHostViewAura::ProcessDisambiguationMouse,
|
||||
base::internal::SupportsWeakPtrBase::StaticAsWeakPtr
|
||||
<RenderWidgetHostViewAura>(this)));
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,8 +86,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
|
||||
public aura::client::ActivationDelegate,
|
||||
public aura::client::ActivationChangeObserver,
|
||||
public aura::client::FocusChangeObserver,
|
||||
public aura::client::CursorClientObserver,
|
||||
public base::SupportsWeakPtr<RenderWidgetHostViewAura> {
|
||||
public aura::client::CursorClientObserver {
|
||||
public:
|
||||
// Displays and controls touch editing elements such as selection handles.
|
||||
class TouchEditingClient {
|
||||
@ -618,8 +617,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
|
||||
// RenderWidgetHostViewGuest.
|
||||
bool is_guest_view_hack_;
|
||||
|
||||
base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
|
||||
|
||||
gfx::Rect disambiguation_target_rect_;
|
||||
|
||||
// The last scroll offset when we start to render the link disambiguation
|
||||
@ -627,6 +624,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
|
||||
// compositing surface and showing the disambiguation popup.
|
||||
gfx::Vector2dF disambiguation_scroll_offset_;
|
||||
|
||||
base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
|
||||
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
|
||||
};
|
||||
|
||||
|
@ -332,6 +332,7 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context,
|
||||
accessibility_mode_(
|
||||
BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()),
|
||||
audio_stream_monitor_(this),
|
||||
virtual_keyboard_requested_(false),
|
||||
loading_weak_factory_(this) {
|
||||
for (size_t i = 0; i < g_created_callbacks.Get().size(); i++)
|
||||
g_created_callbacks.Get().at(i).Run(this);
|
||||
|
@ -1230,10 +1230,10 @@ class CONTENT_EXPORT WebContentsImpl
|
||||
// Created on-demand to mute all audio output from this WebContents.
|
||||
scoped_ptr<WebContentsAudioMuter> audio_muter_;
|
||||
|
||||
base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
|
||||
|
||||
bool virtual_keyboard_requested_;
|
||||
|
||||
base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
|
||||
};
|
||||
|
||||
|
@ -247,8 +247,8 @@ TaskQueueManager::TaskQueueManager(
|
||||
TaskQueueSelector* selector)
|
||||
: main_task_runner_(main_task_runner),
|
||||
selector_(selector),
|
||||
weak_factory_(this),
|
||||
pending_dowork_count_(0) {
|
||||
pending_dowork_count_(0),
|
||||
weak_factory_(this) {
|
||||
DCHECK(main_task_runner->RunsTasksOnCurrentThread());
|
||||
TRACE_EVENT_OBJECT_CREATED_WITH_ID(
|
||||
TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "TaskQueueManager",
|
||||
|
@ -129,12 +129,13 @@ class CONTENT_EXPORT TaskQueueManager {
|
||||
TaskQueueSelector* selector_;
|
||||
|
||||
base::WeakPtr<TaskQueueManager> task_queue_manager_weak_ptr_;
|
||||
base::WeakPtrFactory<TaskQueueManager> weak_factory_;
|
||||
|
||||
// The pending_dowork_count_ is only tracked on the main thread since that's
|
||||
// where re-entrant problems happen.
|
||||
int pending_dowork_count_;
|
||||
|
||||
base::WeakPtrFactory<TaskQueueManager> weak_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TaskQueueManager);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user