diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-08 19:23:33 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-08 19:23:33 +0000 |
commit | dcf10631a987ee1d2609e8538dcd6af0b8bb73fe (patch) | |
tree | ed44db242355c5b2c852742b5b396e51db0901af | |
parent | e8e396fe7c0f64223bee3c485312797b8b7b6024 (diff) | |
download | chromium_src-dcf10631a987ee1d2609e8538dcd6af0b8bb73fe.zip chromium_src-dcf10631a987ee1d2609e8538dcd6af0b8bb73fe.tar.gz chromium_src-dcf10631a987ee1d2609e8538dcd6af0b8bb73fe.tar.bz2 |
Fix some WeakPtrFactory members that aren't last
BUG=303818
Review URL: https://codereview.chromium.org/26308002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227566 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/run_loop.cc | 8 | ||||
-rw-r--r-- | base/run_loop.h | 6 | ||||
-rw-r--r-- | chrome/renderer/pepper/pepper_flash_renderer_host.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/pepper/pepper_flash_renderer_host.h | 2 | ||||
-rw-r--r-- | content/renderer/pepper/content_decryptor_delegate.cc | 6 | ||||
-rw-r--r-- | content/renderer/pepper/content_decryptor_delegate.h | 6 | ||||
-rw-r--r-- | content/renderer/pepper/message_channel.cc | 4 | ||||
-rw-r--r-- | content/renderer/pepper/message_channel.h | 8 | ||||
-rw-r--r-- | net/http/http_server_properties_impl.cc | 6 | ||||
-rw-r--r-- | net/http/http_server_properties_impl.h | 4 | ||||
-rw-r--r-- | net/ssl/server_bound_cert_service.cc | 4 | ||||
-rw-r--r-- | net/ssl/server_bound_cert_service.h | 3 | ||||
-rw-r--r-- | ppapi/proxy/ppb_image_data_proxy.cc | 6 | ||||
-rw-r--r-- | ppapi/proxy/ppb_var_deprecated_proxy.cc | 4 | ||||
-rw-r--r-- | ppapi/proxy/ppb_var_deprecated_proxy.h | 3 | ||||
-rw-r--r-- | ppapi/shared_impl/resource_tracker.h | 4 |
16 files changed, 40 insertions, 38 deletions
diff --git a/base/run_loop.cc b/base/run_loop.cc index 2e80ff2..8666ee4 100644 --- a/base/run_loop.cc +++ b/base/run_loop.cc @@ -10,13 +10,13 @@ namespace base { RunLoop::RunLoop() : loop_(MessageLoop::current()), - weak_factory_(this), previous_run_loop_(NULL), run_depth_(0), run_called_(false), quit_called_(false), running_(false), - quit_when_idle_received_(false) { + quit_when_idle_received_(false), + weak_factory_(this) { #if !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ !defined(USE_GTK_MESSAGE_PUMP) dispatcher_ = NULL; @@ -27,14 +27,14 @@ RunLoop::RunLoop() !defined(USE_GTK_MESSAGE_PUMP) RunLoop::RunLoop(MessageLoop::Dispatcher* dispatcher) : loop_(MessageLoop::current()), - weak_factory_(this), previous_run_loop_(NULL), dispatcher_(dispatcher), run_depth_(0), run_called_(false), quit_called_(false), running_(false), - quit_when_idle_received_(false) { + quit_when_idle_received_(false), + weak_factory_(this) { } #endif diff --git a/base/run_loop.h b/base/run_loop.h index f5ee5c3..0dce634 100644 --- a/base/run_loop.h +++ b/base/run_loop.h @@ -94,9 +94,6 @@ class BASE_EXPORT RunLoop { MessageLoop* loop_; - // WeakPtrFactory for QuitClosure safety. - base::WeakPtrFactory<RunLoop> weak_factory_; - // Parent RunLoop or NULL if this is the top-most RunLoop. RunLoop* previous_run_loop_; @@ -116,6 +113,9 @@ class BASE_EXPORT RunLoop { // that we should quit Run once it becomes idle. bool quit_when_idle_received_; + // WeakPtrFactory for QuitClosure safety. + base::WeakPtrFactory<RunLoop> weak_factory_; + DISALLOW_COPY_AND_ASSIGN(RunLoop); }; diff --git a/chrome/renderer/pepper/pepper_flash_renderer_host.cc b/chrome/renderer/pepper/pepper_flash_renderer_host.cc index e305946..91652b1 100644 --- a/chrome/renderer/pepper/pepper_flash_renderer_host.cc +++ b/chrome/renderer/pepper/pepper_flash_renderer_host.cc @@ -40,8 +40,8 @@ PepperFlashRendererHost::PepperFlashRendererHost( PP_Instance instance, PP_Resource resource) : ResourceHost(host->GetPpapiHost(), instance, resource), - weak_factory_(this), - host_(host) { + host_(host), + weak_factory_(this) { } PepperFlashRendererHost::~PepperFlashRendererHost() { diff --git a/chrome/renderer/pepper/pepper_flash_renderer_host.h b/chrome/renderer/pepper/pepper_flash_renderer_host.h index 299b109..7908880 100644 --- a/chrome/renderer/pepper/pepper_flash_renderer_host.h +++ b/chrome/renderer/pepper/pepper_flash_renderer_host.h @@ -59,12 +59,12 @@ class PepperFlashRendererHost : public ppapi::host::ResourceHost { const PP_Rect& rect); int32_t OnInvokePrinting(ppapi::host::HostMessageContext* host_context); - base::WeakPtrFactory<PepperFlashRendererHost> weak_factory_; // A stack of ReplyMessageContexts to track Navigate() calls which have not // yet been replied to. std::vector<ppapi::host::ReplyMessageContext> navigate_replies_; content::RendererPpapiHost* host_; + base::WeakPtrFactory<PepperFlashRendererHost> weak_factory_; DISALLOW_COPY_AND_ASSIGN(PepperFlashRendererHost); }; diff --git a/content/renderer/pepper/content_decryptor_delegate.cc b/content/renderer/pepper/content_decryptor_delegate.cc index ce91037..3c9dce2 100644 --- a/content/renderer/pepper/content_decryptor_delegate.cc +++ b/content/renderer/pepper/content_decryptor_delegate.cc @@ -232,12 +232,12 @@ ContentDecryptorDelegate::ContentDecryptorDelegate( pending_video_decoder_init_request_id_(0), pending_audio_decode_request_id_(0), pending_video_decode_request_id_(0), - weak_ptr_factory_(this), - weak_this_(weak_ptr_factory_.GetWeakPtr()), audio_sample_format_(media::kUnknownSampleFormat), audio_samples_per_second_(0), audio_channel_count_(0), - audio_bytes_per_frame_(0) { + audio_bytes_per_frame_(0), + weak_ptr_factory_(this) { + weak_this_ = weak_ptr_factory_.GetWeakPtr(); } ContentDecryptorDelegate::~ContentDecryptorDelegate() { diff --git a/content/renderer/pepper/content_decryptor_delegate.h b/content/renderer/pepper/content_decryptor_delegate.h index f58ef9f..26989fa 100644 --- a/content/renderer/pepper/content_decryptor_delegate.h +++ b/content/renderer/pepper/content_decryptor_delegate.h @@ -177,15 +177,15 @@ class ContentDecryptorDelegate { std::queue<uint32_t> free_buffers_; - base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; - base::WeakPtr<ContentDecryptorDelegate> weak_this_; - // Keep track of audio parameters. media::SampleFormat audio_sample_format_; int audio_samples_per_second_; int audio_channel_count_; int audio_bytes_per_frame_; + base::WeakPtr<ContentDecryptorDelegate> weak_this_; + base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); }; diff --git a/content/renderer/pepper/message_channel.cc b/content/renderer/pepper/message_channel.cc index f06b787..32f21a4 100644 --- a/content/renderer/pepper/message_channel.cc +++ b/content/renderer/pepper/message_channel.cc @@ -301,8 +301,8 @@ MessageChannel::MessageChannel(PepperPluginInstanceImpl* instance) : instance_(instance), passthrough_object_(NULL), np_object_(NULL), - weak_ptr_factory_(this), - early_message_queue_state_(QUEUE_MESSAGES) { + early_message_queue_state_(QUEUE_MESSAGES), + weak_ptr_factory_(this) { // Now create an NPObject for receiving calls to postMessage. This sets the // reference count to 1. We release it in the destructor. NPObject* obj = WebBindings::createObject(instance_->instanceNPP(), diff --git a/content/renderer/pepper/message_channel.h b/content/renderer/pepper/message_channel.h index 9c8c28d..f577224 100644 --- a/content/renderer/pepper/message_channel.h +++ b/content/renderer/pepper/message_channel.h @@ -118,10 +118,6 @@ class MessageChannel { void DrainEarlyMessageQueue(); - // This is used to ensure pending tasks will not fire after this object is - // destroyed. - base::WeakPtrFactory<MessageChannel> weak_ptr_factory_; - // TODO(teravest): Remove all the tricky DRAIN_CANCELLED logic once // PluginInstance::ResetAsProxied() is gone. std::deque<WebKit::WebSerializedScriptValue> early_message_queue_; @@ -139,6 +135,10 @@ class MessageChannel { // the order in which messages are processed is preserved. std::list<VarConversionResult> converted_var_queue_; + // This is used to ensure pending tasks will not fire after this object is + // destroyed. + base::WeakPtrFactory<MessageChannel> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(MessageChannel); }; diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc index a0b287d..a4ac6dc 100644 --- a/net/http/http_server_properties_impl.cc +++ b/net/http/http_server_properties_impl.cc @@ -18,9 +18,9 @@ namespace net { static const int kDefaultNumHostsToRemember = 200; HttpServerPropertiesImpl::HttpServerPropertiesImpl() - : weak_ptr_factory_(this), - pipeline_capability_map_( - new CachedPipelineCapabilityMap(kDefaultNumHostsToRemember)) { + : pipeline_capability_map_( + new CachedPipelineCapabilityMap(kDefaultNumHostsToRemember)), + weak_ptr_factory_(this) { } HttpServerPropertiesImpl::~HttpServerPropertiesImpl() { diff --git a/net/http/http_server_properties_impl.h b/net/http/http_server_properties_impl.h index c1e2d4b..cf96b7d 100644 --- a/net/http/http_server_properties_impl.h +++ b/net/http/http_server_properties_impl.h @@ -145,14 +145,14 @@ class NET_EXPORT HttpServerPropertiesImpl // pair) that either support or not support SPDY protocol. typedef base::hash_map<std::string, bool> SpdyServerHostPortTable; - base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; - SpdyServerHostPortTable spdy_servers_table_; AlternateProtocolMap alternate_protocol_map_; SpdySettingsMap spdy_settings_map_; scoped_ptr<CachedPipelineCapabilityMap> pipeline_capability_map_; + base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); }; diff --git a/net/ssl/server_bound_cert_service.cc b/net/ssl/server_bound_cert_service.cc index baed056..58d2209 100644 --- a/net/ssl/server_bound_cert_service.cc +++ b/net/ssl/server_bound_cert_service.cc @@ -371,11 +371,11 @@ ServerBoundCertService::ServerBoundCertService( const scoped_refptr<base::TaskRunner>& task_runner) : server_bound_cert_store_(server_bound_cert_store), task_runner_(task_runner), - weak_ptr_factory_(this), requests_(0), cert_store_hits_(0), inflight_joins_(0), - workers_created_(0) { + workers_created_(0), + weak_ptr_factory_(this) { base::Time start = base::Time::Now(); base::Time end = start + base::TimeDelta::FromDays( kValidityPeriodInDays + kSystemTimeValidityBufferInDays); diff --git a/net/ssl/server_bound_cert_service.h b/net/ssl/server_bound_cert_service.h index 0dc7f4a..4547210 100644 --- a/net/ssl/server_bound_cert_service.h +++ b/net/ssl/server_bound_cert_service.h @@ -197,7 +197,6 @@ class NET_EXPORT ServerBoundCertService // inflight_ maps from a server to an active generation which is taking // place. std::map<std::string, ServerBoundCertServiceJob*> inflight_; - base::WeakPtrFactory<ServerBoundCertService> weak_ptr_factory_; uint64 requests_; uint64 cert_store_hits_; @@ -206,6 +205,8 @@ class NET_EXPORT ServerBoundCertService bool is_system_time_valid_; + base::WeakPtrFactory<ServerBoundCertService> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(ServerBoundCertService); }; diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc index 0ed3c24..c9d61f9 100644 --- a/ppapi/proxy/ppb_image_data_proxy.cc +++ b/ppapi/proxy/ppb_image_data_proxy.cc @@ -249,15 +249,15 @@ class ImageDataCache { // Timer callback to expire entries for the given instance. void OnTimer(PP_Instance instance); + typedef std::map<PP_Instance, ImageDataInstanceCache> CacheMap; + CacheMap cache_; + // This class does timer calls and we don't want to run these outside of the // scope of the object. Technically, since this class is a leaked static, // this will never happen and this factory is unnecessary. However, it's // probably better not to make assumptions about the lifetime of this class. base::WeakPtrFactory<ImageDataCache> weak_factory_; - typedef std::map<PP_Instance, ImageDataInstanceCache> CacheMap; - CacheMap cache_; - DISALLOW_COPY_AND_ASSIGN(ImageDataCache); }; diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.cc b/ppapi/proxy/ppb_var_deprecated_proxy.cc index 43452ef..212a839 100644 --- a/ppapi/proxy/ppb_var_deprecated_proxy.cc +++ b/ppapi/proxy/ppb_var_deprecated_proxy.cc @@ -285,8 +285,8 @@ InterfaceProxy* CreateVarDeprecatedProxy(Dispatcher* dispatcher) { PPB_Var_Deprecated_Proxy::PPB_Var_Deprecated_Proxy( Dispatcher* dispatcher) : InterfaceProxy(dispatcher), - task_factory_(this), - ppb_var_impl_(NULL) { + ppb_var_impl_(NULL), + task_factory_(this) { if (!dispatcher->IsPlugin()) { ppb_var_impl_ = static_cast<const PPB_Var_Deprecated*>( dispatcher->local_get_interface()(PPB_VAR_DEPRECATED_INTERFACE)); diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.h b/ppapi/proxy/ppb_var_deprecated_proxy.h index 59400ae..195c29a 100644 --- a/ppapi/proxy/ppb_var_deprecated_proxy.h +++ b/ppapi/proxy/ppb_var_deprecated_proxy.h @@ -89,10 +89,11 @@ class PPB_Var_Deprecated_Proxy : public InterfaceProxy { void SetAllowPluginReentrancy(); void DoReleaseObject(int64 object_id); - base::WeakPtrFactory<PPB_Var_Deprecated_Proxy> task_factory_; const PPB_Var_Deprecated* ppb_var_impl_; + base::WeakPtrFactory<PPB_Var_Deprecated_Proxy> task_factory_; + DISALLOW_COPY_AND_ASSIGN(PPB_Var_Deprecated_Proxy); }; diff --git a/ppapi/shared_impl/resource_tracker.h b/ppapi/shared_impl/resource_tracker.h index ee93376..6feeea7 100644 --- a/ppapi/shared_impl/resource_tracker.h +++ b/ppapi/shared_impl/resource_tracker.h @@ -126,14 +126,14 @@ class PPAPI_SHARED_EXPORT ResourceTracker { int32 last_resource_value_; - base::WeakPtrFactory<ResourceTracker> weak_ptr_factory_; - // On the host side, we want to check that we are only called on the main // thread. This is to protect us from accidentally using the tracker from // other threads (especially the IO thread). On the plugin side, the tracker // is protected by the proxy lock and is thread-safe, so this will be NULL. scoped_ptr<base::ThreadChecker> thread_checker_; + base::WeakPtrFactory<ResourceTracker> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(ResourceTracker); }; |