Commit 0184ced8 authored by anujk.sharma's avatar anujk.sharma Committed by Commit bot

Declaring the weak_ptr_factory in proper order.

Cleaning up weak_ptr_factory destruction order in "src/ipc" module.
WeakPtrFactory should remain the last member so it'll be destroyed and
invalidate its weak pointers before any other members are destroyed.

BUG=303818

Review URL: https://codereview.chromium.org/508903002

Cr-Commit-Position: refs/heads/master@{#292334}
parent 884ad197
...@@ -43,6 +43,7 @@ Anish Patankar <anish.p@samsung.com> ...@@ -43,6 +43,7 @@ Anish Patankar <anish.p@samsung.com>
Ankit Kumar <ankit2.kumar@samsung.com> Ankit Kumar <ankit2.kumar@samsung.com>
Anssi Hannula <anssi.hannula@iki.fi> Anssi Hannula <anssi.hannula@iki.fi>
Antonio Gomes <a1.gomes@sisa.samsung.com> Antonio Gomes <a1.gomes@sisa.samsung.com>
Anuj Kumar Sharma <anujk.sharma@samsung.com>
Arnaud Renevier <a.renevier@samsung.com> Arnaud Renevier <a.renevier@samsung.com>
Arpita Bahuguna <a.bah@samsung.com> Arpita Bahuguna <a.bah@samsung.com>
Arthur Lussos <developer0420@gmail.com> Arthur Lussos <developer0420@gmail.com>
......
...@@ -106,10 +106,8 @@ class ChannelWin : public Channel, ...@@ -106,10 +106,8 @@ class ChannelWin : public Channel,
// compatability with existing clients that don't validate the channel.) // compatability with existing clients that don't validate the channel.)
int32 client_secret_; int32 client_secret_;
base::WeakPtrFactory<ChannelWin> weak_factory_;
scoped_ptr<base::ThreadChecker> thread_check_; scoped_ptr<base::ThreadChecker> thread_check_;
base::WeakPtrFactory<ChannelWin> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ChannelWin); DISALLOW_COPY_AND_ASSIGN(ChannelWin);
}; };
......
...@@ -484,10 +484,10 @@ scoped_ptr<ChannelFactory> ChannelMojo::CreateFactory( ...@@ -484,10 +484,10 @@ scoped_ptr<ChannelFactory> ChannelMojo::CreateFactory(
ChannelMojo::ChannelMojo( ChannelMojo::ChannelMojo(
scoped_ptr<Channel> bootstrap, Mode mode, Listener* listener, scoped_ptr<Channel> bootstrap, Mode mode, Listener* listener,
scoped_refptr<base::TaskRunner> io_thread_task_runner) scoped_refptr<base::TaskRunner> io_thread_task_runner)
: weak_factory_(this), : bootstrap_(bootstrap.Pass()),
bootstrap_(bootstrap.Pass()),
mode_(mode), listener_(listener), mode_(mode), listener_(listener),
peer_pid_(base::kNullProcessId) { peer_pid_(base::kNullProcessId),
weak_factory_(this) {
if (base::MessageLoopProxy::current() == io_thread_task_runner.get()) { if (base::MessageLoopProxy::current() == io_thread_task_runner.get()) {
InitOnIOThread(); InitOnIOThread();
} else { } else {
......
...@@ -108,7 +108,6 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel { ...@@ -108,7 +108,6 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel {
void InitOnIOThread(); void InitOnIOThread();
base::WeakPtrFactory<ChannelMojo> weak_factory_;
scoped_ptr<Channel> bootstrap_; scoped_ptr<Channel> bootstrap_;
Mode mode_; Mode mode_;
Listener* listener_; Listener* listener_;
...@@ -120,6 +119,8 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel { ...@@ -120,6 +119,8 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel {
scoped_ptr<MessageReader, ReaderDeleter> message_reader_; scoped_ptr<MessageReader, ReaderDeleter> message_reader_;
ScopedVector<Message> pending_messages_; ScopedVector<Message> pending_messages_;
base::WeakPtrFactory<ChannelMojo> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ChannelMojo); DISALLOW_COPY_AND_ASSIGN(ChannelMojo);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment