summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorn.bansal@samsung.com <n.bansal@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-27 20:55:18 +0000
committern.bansal@samsung.com <n.bansal@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-27 20:55:18 +0000
commit0a30cf516cbb1b3888e3bcc1397548528c00c1b7 (patch)
tree93b5259bcdd3956595663f17c6f34b14eba7c103 /net
parent27e528323c1868255779f98e019e71920cf9fef2 (diff)
downloadchromium_src-0a30cf516cbb1b3888e3bcc1397548528c00c1b7.zip
chromium_src-0a30cf516cbb1b3888e3bcc1397548528c00c1b7.tar.gz
chromium_src-0a30cf516cbb1b3888e3bcc1397548528c00c1b7.tar.bz2
Fix WeakPtrFactory member order
Fix WeakPtrFactory member order in net/spdy/ & net/dns/ BUG=303818 Review URL: https://codereview.chromium.org/301573002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273022 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/dns/dns_config_service_posix.cc7
-rw-r--r--net/dns/host_resolver_impl.cc6
-rw-r--r--net/dns/host_resolver_impl.h8
-rw-r--r--net/spdy/spdy_http_stream.cc6
-rw-r--r--net/spdy/spdy_http_stream.h4
-rw-r--r--net/spdy/spdy_proxy_client_socket.cc4
-rw-r--r--net/spdy/spdy_proxy_client_socket.h4
-rw-r--r--net/spdy/spdy_session.cc6
-rw-r--r--net/spdy/spdy_session.h15
-rw-r--r--net/spdy/spdy_stream.cc4
-rw-r--r--net/spdy/spdy_stream.h4
-rw-r--r--net/spdy/spdy_websocket_stream.cc6
-rw-r--r--net/spdy/spdy_websocket_stream.h3
13 files changed, 40 insertions, 37 deletions
diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
index 0644d4d..2c298dd 100644
--- a/net/dns/dns_config_service_posix.cc
+++ b/net/dns/dns_config_service_posix.cc
@@ -202,8 +202,8 @@ ConfigParsePosixResult ReadDnsConfig(DnsConfig* dns_config) {
class DnsConfigServicePosix::Watcher {
public:
explicit Watcher(DnsConfigServicePosix* service)
- : weak_factory_(this),
- service_(service) {}
+ : service_(service),
+ weak_factory_(this) {}
~Watcher() {}
bool Watch() {
@@ -246,11 +246,12 @@ class DnsConfigServicePosix::Watcher {
service_->OnHostsChanged(!error);
}
- base::WeakPtrFactory<Watcher> weak_factory_;
DnsConfigServicePosix* service_;
DnsConfigWatcher config_watcher_;
base::FilePathWatcher hosts_watcher_;
+ base::WeakPtrFactory<Watcher> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(Watcher);
};
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
index a1ab0e5..dd11336 100644
--- a/net/dns/host_resolver_impl.cc
+++ b/net/dns/host_resolver_impl.cc
@@ -1798,15 +1798,15 @@ HostResolverImpl::HostResolverImpl(
proc_params_(proc_params),
net_log_(net_log),
default_address_family_(ADDRESS_FAMILY_UNSPECIFIED),
- weak_ptr_factory_(this),
- probe_weak_ptr_factory_(this),
received_dns_config_(false),
num_dns_failures_(0),
probe_ipv6_support_(true),
use_local_ipv6_(false),
resolved_known_ipv6_hostname_(false),
additional_resolver_flags_(0),
- fallback_to_proctask_(true) {
+ fallback_to_proctask_(true),
+ weak_ptr_factory_(this),
+ probe_weak_ptr_factory_(this) {
DCHECK_GE(dispatcher_.num_priorities(), static_cast<size_t>(NUM_PRIORITIES));
diff --git a/net/dns/host_resolver_impl.h b/net/dns/host_resolver_impl.h
index b2de64b..7bcc800 100644
--- a/net/dns/host_resolver_impl.h
+++ b/net/dns/host_resolver_impl.h
@@ -260,10 +260,6 @@ class NET_EXPORT HostResolverImpl
// Address family to use when the request doesn't specify one.
AddressFamily default_address_family_;
- base::WeakPtrFactory<HostResolverImpl> weak_ptr_factory_;
-
- base::WeakPtrFactory<HostResolverImpl> probe_weak_ptr_factory_;
-
// If present, used by DnsTask and ServeFromHosts to resolve requests.
scoped_ptr<DnsClient> dns_client_;
@@ -292,6 +288,10 @@ class NET_EXPORT HostResolverImpl
// Allow fallback to ProcTask if DnsTask fails.
bool fallback_to_proctask_;
+ base::WeakPtrFactory<HostResolverImpl> weak_ptr_factory_;
+
+ base::WeakPtrFactory<HostResolverImpl> probe_weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(HostResolverImpl);
};
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index b3203ff..a327768 100644
--- a/net/spdy/spdy_http_stream.cc
+++ b/net/spdy/spdy_http_stream.cc
@@ -27,8 +27,7 @@ namespace net {
SpdyHttpStream::SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session,
bool direct)
- : weak_factory_(this),
- spdy_session_(spdy_session),
+ : spdy_session_(spdy_session),
is_reused_(spdy_session_->IsReused()),
stream_closed_(false),
closed_stream_status_(ERR_FAILED),
@@ -41,7 +40,8 @@ SpdyHttpStream::SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session,
request_body_buf_size_(0),
buffered_read_callback_pending_(false),
more_read_data_pending_(false),
- direct_(direct) {
+ direct_(direct),
+ weak_factory_(this) {
DCHECK(spdy_session_.get());
}
diff --git a/net/spdy/spdy_http_stream.h b/net/spdy/spdy_http_stream.h
index 5a9377c..44c2641 100644
--- a/net/spdy/spdy_http_stream.h
+++ b/net/spdy/spdy_http_stream.h
@@ -109,8 +109,6 @@ class NET_EXPORT_PRIVATE SpdyHttpStream : public SpdyStream::Delegate,
bool DoBufferedReadCallback();
bool ShouldWaitForMoreBufferedData() const;
- base::WeakPtrFactory<SpdyHttpStream> weak_factory_;
-
const base::WeakPtr<SpdySession> spdy_session_;
bool is_reused_;
SpdyStreamRequest stream_request_;
@@ -161,6 +159,8 @@ class NET_EXPORT_PRIVATE SpdyHttpStream : public SpdyStream::Delegate,
// Is this spdy stream direct to the origin server (or to a proxy).
bool direct_;
+ base::WeakPtrFactory<SpdyHttpStream> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream);
};
diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc
index 74e6d74..01c30b9 100644
--- a/net/spdy/spdy_proxy_client_socket.cc
+++ b/net/spdy/spdy_proxy_client_socket.cc
@@ -45,9 +45,9 @@ SpdyProxyClientSocket::SpdyProxyClientSocket(
write_buffer_len_(0),
was_ever_used_(false),
redirect_has_load_timing_info_(false),
- weak_factory_(this),
net_log_(BoundNetLog::Make(spdy_stream->net_log().net_log(),
- NetLog::SOURCE_PROXY_CLIENT_SOCKET)) {
+ NetLog::SOURCE_PROXY_CLIENT_SOCKET)),
+ weak_factory_(this) {
request_.method = "CONNECT";
request_.url = url;
if (!user_agent.empty())
diff --git a/net/spdy/spdy_proxy_client_socket.h b/net/spdy/spdy_proxy_client_socket.h
index 4c4e8fd..fc9cae2 100644
--- a/net/spdy/spdy_proxy_client_socket.h
+++ b/net/spdy/spdy_proxy_client_socket.h
@@ -163,10 +163,10 @@ class NET_EXPORT_PRIVATE SpdyProxyClientSocket : public ProxyClientSocket,
bool redirect_has_load_timing_info_;
LoadTimingInfo redirect_load_timing_info_;
- base::WeakPtrFactory<SpdyProxyClientSocket> weak_factory_;
-
const BoundNetLog net_log_;
+ base::WeakPtrFactory<SpdyProxyClientSocket> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocket);
};
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 347c6fd..4aa21d4 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -458,8 +458,7 @@ SpdySession::SpdySession(
TimeFunc time_func,
const HostPortPair& trusted_spdy_proxy,
NetLog* net_log)
- : weak_factory_(this),
- in_io_loop_(false),
+ : in_io_loop_(false),
spdy_session_key_(spdy_session_key),
pool_(NULL),
http_server_properties_(http_server_properties),
@@ -513,7 +512,8 @@ SpdySession::SpdySession(
hung_interval_(
base::TimeDelta::FromSeconds(kHungIntervalSeconds)),
trusted_spdy_proxy_(trusted_spdy_proxy),
- time_func_(time_func) {
+ time_func_(time_func),
+ weak_factory_(this) {
DCHECK_GE(protocol_, kProtoSPDYMinimumVersion);
DCHECK_LE(protocol_, kProtoSPDYMaximumVersion);
DCHECK(HttpStreamFactory::spdy_enabled());
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index 51ed3f2..9e2d064 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -180,7 +180,6 @@ class NET_EXPORT_PRIVATE SpdyStreamRequest {
void Reset();
- base::WeakPtrFactory<SpdyStreamRequest> weak_ptr_factory_;
SpdyStreamType type_;
base::WeakPtr<SpdySession> session_;
base::WeakPtr<SpdyStream> stream_;
@@ -189,6 +188,8 @@ class NET_EXPORT_PRIVATE SpdyStreamRequest {
BoundNetLog net_log_;
CompletionCallback callback_;
+ base::WeakPtrFactory<SpdyStreamRequest> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(SpdyStreamRequest);
};
@@ -931,12 +932,6 @@ class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface,
// or NULL, if the transport is not SSL.
SSLClientSocket* GetSSLClientSocket() const;
- // Used for posting asynchronous IO tasks. We use this even though
- // SpdySession is refcounted because we don't need to keep the SpdySession
- // alive if the last reference is within a RunnableMethod. Just revoke the
- // method.
- base::WeakPtrFactory<SpdySession> weak_factory_;
-
// Whether Do{Read,Write}Loop() is in the call stack. Useful for
// making sure we don't destroy ourselves prematurely in that case.
bool in_io_loop_;
@@ -1132,6 +1127,12 @@ class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface,
HostPortPair trusted_spdy_proxy_;
TimeFunc time_func_;
+
+ // Used for posting asynchronous IO tasks. We use this even though
+ // SpdySession is refcounted because we don't need to keep the SpdySession
+ // alive if the last reference is within a RunnableMethod. Just revoke the
+ // method.
+ base::WeakPtrFactory<SpdySession> weak_factory_;
};
} // namespace net
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
index 3988905..682eb46 100644
--- a/net/spdy/spdy_stream.cc
+++ b/net/spdy/spdy_stream.cc
@@ -85,7 +85,6 @@ SpdyStream::SpdyStream(SpdyStreamType type,
int32 initial_recv_window_size,
const BoundNetLog& net_log)
: type_(type),
- weak_ptr_factory_(this),
stream_id_(0),
url_(url),
priority_(priority),
@@ -104,7 +103,8 @@ SpdyStream::SpdyStream(SpdyStreamType type,
raw_received_bytes_(0),
send_bytes_(0),
recv_bytes_(0),
- write_handler_guard_(false) {
+ write_handler_guard_(false),
+ weak_ptr_factory_(this) {
CHECK(type_ == SPDY_BIDIRECTIONAL_STREAM ||
type_ == SPDY_REQUEST_RESPONSE_STREAM ||
type_ == SPDY_PUSH_STREAM);
diff --git a/net/spdy/spdy_stream.h b/net/spdy/spdy_stream.h
index 4e3c61a..e107143 100644
--- a/net/spdy/spdy_stream.h
+++ b/net/spdy/spdy_stream.h
@@ -488,8 +488,6 @@ class NET_EXPORT_PRIVATE SpdyStream {
const SpdyStreamType type_;
- base::WeakPtrFactory<SpdyStream> weak_ptr_factory_;
-
SpdyStreamId stream_id_;
const GURL url_;
const RequestPriority priority_;
@@ -562,6 +560,8 @@ class NET_EXPORT_PRIVATE SpdyStream {
// down.
bool write_handler_guard_;
+ base::WeakPtrFactory<SpdyStream> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(SpdyStream);
};
diff --git a/net/spdy/spdy_websocket_stream.cc b/net/spdy/spdy_websocket_stream.cc
index c0eac28..54e668c 100644
--- a/net/spdy/spdy_websocket_stream.cc
+++ b/net/spdy/spdy_websocket_stream.cc
@@ -19,10 +19,10 @@ namespace net {
SpdyWebSocketStream::SpdyWebSocketStream(
const base::WeakPtr<SpdySession>& spdy_session, Delegate* delegate)
- : weak_ptr_factory_(this),
- spdy_session_(spdy_session),
+ : spdy_session_(spdy_session),
pending_send_data_length_(0),
- delegate_(delegate) {
+ delegate_(delegate),
+ weak_ptr_factory_(this) {
DCHECK(spdy_session_.get());
DCHECK(delegate_);
}
diff --git a/net/spdy/spdy_websocket_stream.h b/net/spdy/spdy_websocket_stream.h
index 169d1e4..6998134 100644
--- a/net/spdy/spdy_websocket_stream.h
+++ b/net/spdy/spdy_websocket_stream.h
@@ -88,13 +88,14 @@ class NET_EXPORT_PRIVATE SpdyWebSocketStream
void OnSpdyStreamCreated(int status);
- base::WeakPtrFactory<SpdyWebSocketStream> weak_ptr_factory_;
SpdyStreamRequest stream_request_;
base::WeakPtr<SpdyStream> stream_;
const base::WeakPtr<SpdySession> spdy_session_;
size_t pending_send_data_length_;
Delegate* delegate_;
+ base::WeakPtrFactory<SpdyWebSocketStream> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream);
};