diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-30 20:06:30 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-30 20:06:30 +0000 |
commit | 20f0487a5b73e8071af2612150301b0942cbf0e2 (patch) | |
tree | ecee69b28f16712bdc1558ac0a015ac80095c761 /webkit | |
parent | 167b0dd17d5ed57ff293b6480ccaed706e0bc9cb (diff) | |
download | chromium_src-20f0487a5b73e8071af2612150301b0942cbf0e2.zip chromium_src-20f0487a5b73e8071af2612150301b0942cbf0e2.tar.gz chromium_src-20f0487a5b73e8071af2612150301b0942cbf0e2.tar.bz2 |
FBTF: Move ctors/dtors into implementation files. Adds ctors/dtors to non-POD structs.
Cuts ~2MB off our .a files (Debug, Linux). Also added the "virtual" keyword on
a whole bunch of virtual dtors that were missing it.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/3522004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61100 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
22 files changed, 141 insertions, 60 deletions
diff --git a/webkit/appcache/appcache_backend_impl.cc b/webkit/appcache/appcache_backend_impl.cc index e077a33..a9349fa 100644 --- a/webkit/appcache/appcache_backend_impl.cc +++ b/webkit/appcache/appcache_backend_impl.cc @@ -12,6 +12,12 @@ namespace appcache { +AppCacheBackendImpl::AppCacheBackendImpl() + : service_(NULL), + frontend_(NULL), + process_id_(0) { +} + AppCacheBackendImpl::~AppCacheBackendImpl() { STLDeleteValues(&hosts_); if (service_) diff --git a/webkit/appcache/appcache_backend_impl.h b/webkit/appcache/appcache_backend_impl.h index d299641..ac563ff 100644 --- a/webkit/appcache/appcache_backend_impl.h +++ b/webkit/appcache/appcache_backend_impl.h @@ -14,7 +14,7 @@ class AppCacheService; class AppCacheBackendImpl { public: - AppCacheBackendImpl() : service_(NULL), frontend_(NULL), process_id_(0) {} + AppCacheBackendImpl(); ~AppCacheBackendImpl(); void Initialize(AppCacheService* service, diff --git a/webkit/appcache/appcache_interfaces.cc b/webkit/appcache/appcache_interfaces.cc index a818bb9..4ed0f09 100644 --- a/webkit/appcache/appcache_interfaces.cc +++ b/webkit/appcache/appcache_interfaces.cc @@ -23,6 +23,29 @@ const char kHttpHEADMethod[] = "HEAD"; const FilePath::CharType kAppCacheDatabaseName[] = FILE_PATH_LITERAL("Index"); +AppCacheInfo::AppCacheInfo() + : cache_id(kNoCacheId), + status(UNCACHED), + size(0), + is_complete(false) { +} + +AppCacheInfo::~AppCacheInfo() { +} + +AppCacheResourceInfo::AppCacheResourceInfo() + : url(), + size(0), + is_master(0), + is_manifest(0), + is_fallback(0), + is_foreign(0), + is_explicit(0) { +} + +AppCacheResourceInfo::~AppCacheResourceInfo() { +} + bool IsSchemeSupported(const GURL& url) { bool supported = url.SchemeIs(kHttpScheme) || url.SchemeIs(kHttpsScheme); #ifndef NDEBUG @@ -85,4 +108,4 @@ COMPILE_ASSERT((int)WebConsoleMessage::LevelWarning == COMPILE_ASSERT((int)WebConsoleMessage::LevelError == (int)LOG_ERROR, LevelError); -} // namespace +} // namespace appcache diff --git a/webkit/appcache/appcache_interfaces.h b/webkit/appcache/appcache_interfaces.h index 1dfd326..973f795 100644 --- a/webkit/appcache/appcache_interfaces.h +++ b/webkit/appcache/appcache_interfaces.h @@ -53,6 +53,9 @@ enum LogLevel { }; struct AppCacheInfo { + AppCacheInfo(); + ~AppCacheInfo(); + GURL manifest_url; base::Time creation_time; base::Time last_update_time; @@ -61,14 +64,15 @@ struct AppCacheInfo { Status status; int64 size; bool is_complete; - AppCacheInfo() : cache_id(kNoCacheId), status(UNCACHED), - size(0), is_complete(false) { } }; typedef std::vector<AppCacheInfo> AppCacheInfoVector; -// POD type to hold information about a single appcache resource. +// Type to hold information about a single appcache resource. struct AppCacheResourceInfo { + AppCacheResourceInfo(); + ~AppCacheResourceInfo(); + GURL url; int64 size; bool is_master; diff --git a/webkit/appcache/appcache_response.cc b/webkit/appcache/appcache_response.cc index c44eac6..54bba14 100644 --- a/webkit/appcache/appcache_response.cc +++ b/webkit/appcache/appcache_response.cc @@ -63,6 +63,15 @@ AppCacheResponseInfo::~AppCacheResponseInfo() { service_->storage()->working_set()->RemoveResponseInfo(this); } +// HttpResponseInfoIOBuffer ------------------------------------------ + +HttpResponseInfoIOBuffer::HttpResponseInfoIOBuffer() + : response_data_size(kUnkownResponseDataSize) {} + +HttpResponseInfoIOBuffer::HttpResponseInfoIOBuffer(net::HttpResponseInfo* info) + : http_info(info), response_data_size(kUnkownResponseDataSize) {} + +HttpResponseInfoIOBuffer::~HttpResponseInfoIOBuffer() {} // AppCacheResponseIO ---------------------------------------------- diff --git a/webkit/appcache/appcache_response.h b/webkit/appcache/appcache_response.h index 1f8ecce..5f62b14 100644 --- a/webkit/appcache/appcache_response.h +++ b/webkit/appcache/appcache_response.h @@ -48,7 +48,7 @@ class AppCacheResponseInfo private: friend class base::RefCounted<AppCacheResponseInfo>; - ~AppCacheResponseInfo(); + virtual ~AppCacheResponseInfo(); const GURL manifest_url_; const int64 response_id_; @@ -64,15 +64,12 @@ struct HttpResponseInfoIOBuffer scoped_ptr<net::HttpResponseInfo> http_info; int response_data_size; - HttpResponseInfoIOBuffer() - : response_data_size(kUnkownResponseDataSize) {} - explicit HttpResponseInfoIOBuffer(net::HttpResponseInfo* info) - : http_info(info), response_data_size(kUnkownResponseDataSize) {} + HttpResponseInfoIOBuffer(); + explicit HttpResponseInfoIOBuffer(net::HttpResponseInfo* info); private: friend class base::RefCountedThreadSafe<HttpResponseInfoIOBuffer>; - - ~HttpResponseInfoIOBuffer() {} + virtual ~HttpResponseInfoIOBuffer(); }; // Common base class for response reader and writer. diff --git a/webkit/appcache/appcache_service.cc b/webkit/appcache/appcache_service.cc index bf8fba2..c6bba28 100644 --- a/webkit/appcache/appcache_service.cc +++ b/webkit/appcache/appcache_service.cc @@ -12,6 +12,10 @@ namespace appcache { +AppCacheInfoCollection::AppCacheInfoCollection() {} + +AppCacheInfoCollection::~AppCacheInfoCollection() {} + // AsyncHelper ------- class AppCacheService::AsyncHelper diff --git a/webkit/appcache/appcache_service.h b/webkit/appcache/appcache_service.h index fe5ec60..ebd8fb7 100644 --- a/webkit/appcache/appcache_service.h +++ b/webkit/appcache/appcache_service.h @@ -32,7 +32,9 @@ class AppCachePolicy; // Refcounted container to avoid copying the collection in callbacks. struct AppCacheInfoCollection : public base::RefCountedThreadSafe<AppCacheInfoCollection> { - virtual ~AppCacheInfoCollection() {} + AppCacheInfoCollection(); + virtual ~AppCacheInfoCollection(); + std::map<GURL, AppCacheInfoVector> infos_by_origin; }; diff --git a/webkit/appcache/appcache_storage.cc b/webkit/appcache/appcache_storage.cc index 445b965..01c18f1 100644 --- a/webkit/appcache/appcache_storage.cc +++ b/webkit/appcache/appcache_storage.cc @@ -22,6 +22,18 @@ AppCacheStorage::~AppCacheStorage() { DCHECK(delegate_references_.empty()); } +AppCacheStorage::DelegateReference::DelegateReference( + Delegate* delegate, AppCacheStorage* storage) + : delegate(delegate), storage(storage) { + storage->delegate_references_.insert( + DelegateReferenceMap::value_type(delegate, this)); +} + +AppCacheStorage::DelegateReference::~DelegateReference() { + if (delegate) + storage->delegate_references_.erase(delegate); +} + AppCacheStorage::ResponseInfoLoadTask::ResponseInfoLoadTask( const GURL& manifest_url, int64 response_id, @@ -36,6 +48,9 @@ AppCacheStorage::ResponseInfoLoadTask::ResponseInfoLoadTask( PendingResponseInfoLoads::value_type(response_id, this)); } +AppCacheStorage::ResponseInfoLoadTask::~ResponseInfoLoadTask() { +} + void AppCacheStorage::ResponseInfoLoadTask::StartIfNeeded() { if (reader_.get()) return; diff --git a/webkit/appcache/appcache_storage.h b/webkit/appcache/appcache_storage.h index 559237c..20fbffe 100644 --- a/webkit/appcache/appcache_storage.h +++ b/webkit/appcache/appcache_storage.h @@ -206,11 +206,7 @@ class AppCacheStorage { Delegate* delegate; AppCacheStorage* storage; - DelegateReference(Delegate* delegate, AppCacheStorage* storage) - : delegate(delegate), storage(storage) { - storage->delegate_references_.insert( - DelegateReferenceMap::value_type(delegate, this)); - } + DelegateReference(Delegate* delegate, AppCacheStorage* storage); void CancelReference() { storage->delegate_references_.erase(delegate); @@ -221,10 +217,7 @@ class AppCacheStorage { private: friend class base::RefCounted<DelegateReference>; - ~DelegateReference() { - if (delegate) - storage->delegate_references_.erase(delegate); - } + virtual ~DelegateReference(); }; typedef std::map<Delegate*, DelegateReference*> DelegateReferenceMap; typedef std::vector<scoped_refptr<DelegateReference> > @@ -236,6 +229,7 @@ class AppCacheStorage { public: ResponseInfoLoadTask(const GURL& manifest_url, int64 response_id, AppCacheStorage* storage); + ~ResponseInfoLoadTask(); int64 response_id() const { return response_id_; } const GURL& manifest_url() const { return manifest_url_; } diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc index 5433e55..7d48a3a 100644 --- a/webkit/appcache/appcache_update_job.cc +++ b/webkit/appcache/appcache_update_job.cc @@ -123,6 +123,17 @@ class HostNotifier { NotifyHostMap hosts_to_notify; }; +AppCacheUpdateJob::UrlToFetch::UrlToFetch(const GURL& url, + bool checked, + AppCacheResponseInfo* info) + : url(url), + storage_checked(checked), + existing_response_info(info) { +} + +AppCacheUpdateJob::UrlToFetch::~UrlToFetch() { +} + AppCacheUpdateJob::AppCacheUpdateJob(AppCacheService* service, AppCacheGroup* group) : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), diff --git a/webkit/appcache/appcache_update_job.h b/webkit/appcache/appcache_update_job.h index 9d82e68..b0a683c 100644 --- a/webkit/appcache/appcache_update_job.h +++ b/webkit/appcache/appcache_update_job.h @@ -83,11 +83,12 @@ class AppCacheUpdateJob : public URLRequest::Delegate, }; struct UrlToFetch { + UrlToFetch(const GURL& url, bool checked, AppCacheResponseInfo* info); + ~UrlToFetch(); + GURL url; bool storage_checked; scoped_refptr<AppCacheResponseInfo> existing_response_info; - UrlToFetch(const GURL& url, bool checked, AppCacheResponseInfo* info) - : url(url), storage_checked(checked), existing_response_info(info) {} }; UpdateJobInfo* GetUpdateJobInfo(URLRequest* request); diff --git a/webkit/appcache/appcache_working_set.cc b/webkit/appcache/appcache_working_set.cc index 1c3f40b..e7bdf53 100644 --- a/webkit/appcache/appcache_working_set.cc +++ b/webkit/appcache/appcache_working_set.cc @@ -11,6 +11,8 @@ namespace appcache { +AppCacheWorkingSet::AppCacheWorkingSet() : is_disabled_(false) {} + AppCacheWorkingSet::~AppCacheWorkingSet() { DCHECK(caches_.empty()); DCHECK(groups_.empty()); diff --git a/webkit/appcache/appcache_working_set.h b/webkit/appcache/appcache_working_set.h index 15221d12..d7e4fc9 100644 --- a/webkit/appcache/appcache_working_set.h +++ b/webkit/appcache/appcache_working_set.h @@ -22,7 +22,7 @@ class AppCacheWorkingSet { public: typedef std::map<GURL, AppCacheGroup*> GroupMap; - AppCacheWorkingSet() : is_disabled_(false) {} + AppCacheWorkingSet(); ~AppCacheWorkingSet(); void Disable(); diff --git a/webkit/appcache/manifest_parser.cc b/webkit/appcache/manifest_parser.cc index cbd1c68..68b37d8 100644 --- a/webkit/appcache/manifest_parser.cc +++ b/webkit/appcache/manifest_parser.cc @@ -45,6 +45,10 @@ enum Mode { UNKNOWN, }; +Manifest::Manifest() : online_whitelist_all(false) {} + +Manifest::~Manifest() {} + bool ParseManifest(const GURL& manifest_url, const char* data, int length, Manifest& manifest) { static const std::wstring kSignature(L"CACHE MANIFEST"); diff --git a/webkit/appcache/manifest_parser.h b/webkit/appcache/manifest_parser.h index e9f80d9..19d5cac 100644 --- a/webkit/appcache/manifest_parser.h +++ b/webkit/appcache/manifest_parser.h @@ -44,12 +44,13 @@ namespace appcache { typedef std::pair<GURL, GURL> FallbackNamespace; struct Manifest { + Manifest(); + ~Manifest(); + base::hash_set<std::string> explicit_urls; std::vector<FallbackNamespace> fallback_namespaces; std::vector<GURL> online_whitelist_namespaces; bool online_whitelist_all; - - Manifest() : online_whitelist_all(false) {} }; bool ParseManifest(const GURL& manifest_url, const char* data, int length, diff --git a/webkit/glue/plugins/pepper_url_request_info.cc b/webkit/glue/plugins/pepper_url_request_info.cc index 4edbe83..24348b7 100644 --- a/webkit/glue/plugins/pepper_url_request_info.cc +++ b/webkit/glue/plugins/pepper_url_request_info.cc @@ -123,6 +123,31 @@ const PPB_URLRequestInfo_Dev ppb_urlrequestinfo = { } // namespace +struct URLRequestInfo::BodyItem { + BodyItem(const std::string& data) + : data(data), + start_offset(0), + number_of_bytes(-1), + expected_last_modified_time(0.0) { + } + + BodyItem(FileRef* file_ref, + int64_t start_offset, + int64_t number_of_bytes, + PP_Time expected_last_modified_time) + : file_ref(file_ref), + start_offset(start_offset), + number_of_bytes(number_of_bytes), + expected_last_modified_time(expected_last_modified_time) { + } + + std::string data; + scoped_refptr<FileRef> file_ref; + int64_t start_offset; + int64_t number_of_bytes; + PP_Time expected_last_modified_time; +}; + URLRequestInfo::URLRequestInfo(PluginModule* module) : Resource(module), stream_to_file_(false) { diff --git a/webkit/glue/plugins/pepper_url_request_info.h b/webkit/glue/plugins/pepper_url_request_info.h index 7220531..2d394d5 100644 --- a/webkit/glue/plugins/pepper_url_request_info.h +++ b/webkit/glue/plugins/pepper_url_request_info.h @@ -45,31 +45,7 @@ class URLRequestInfo : public Resource { WebKit::WebURLRequest ToWebURLRequest(WebKit::WebFrame* frame) const; private: - struct BodyItem { - BodyItem(const std::string& data) - : data(data), - start_offset(0), - number_of_bytes(-1), - expected_last_modified_time(0.0) { - } - - BodyItem(FileRef* file_ref, - int64_t start_offset, - int64_t number_of_bytes, - PP_Time expected_last_modified_time) - : file_ref(file_ref), - start_offset(start_offset), - number_of_bytes(number_of_bytes), - expected_last_modified_time(expected_last_modified_time) { - } - - std::string data; - scoped_refptr<FileRef> file_ref; - int64_t start_offset; - int64_t number_of_bytes; - PP_Time expected_last_modified_time; - }; - + struct BodyItem; typedef std::vector<BodyItem> Body; std::string url_; diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc index 2f71d43..a8d0534 100644 --- a/webkit/glue/plugins/plugin_list.cc +++ b/webkit/glue/plugins/plugin_list.cc @@ -445,6 +445,9 @@ bool PluginList::EnablePlugin(const FilePath& filename) { return did_enable; } +PluginList::~PluginList() { +} + bool PluginList::DisablePlugin(const FilePath& filename) { AutoLock lock(lock_); diff --git a/webkit/glue/plugins/plugin_list.h b/webkit/glue/plugins/plugin_list.h index 36d8941..c0108ef 100644 --- a/webkit/glue/plugins/plugin_list.h +++ b/webkit/glue/plugins/plugin_list.h @@ -164,6 +164,8 @@ class PluginList { // will be disabled. bool DisablePlugin(const FilePath& filename); + ~PluginList(); + private: // Constructors are private for singletons PluginList(); diff --git a/webkit/glue/plugins/webplugin_impl.cc b/webkit/glue/plugins/webplugin_impl.cc index 80bc197..704145b 100644 --- a/webkit/glue/plugins/webplugin_impl.cc +++ b/webkit/glue/plugins/webplugin_impl.cc @@ -4,6 +4,7 @@ #include "webkit/glue/plugins/webplugin_impl.h" +#include "base/linked_ptr.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/string_util.h" @@ -207,6 +208,14 @@ void GetResponseInfo(const WebURLResponse& response, // WebKit::WebPlugin ---------------------------------------------------------- +struct WebPluginImpl::ClientInfo { + unsigned long id; + WebPluginResourceClient* client; + WebKit::WebURLRequest request; + bool pending_failure_notification; + linked_ptr<WebKit::WebURLLoader> loader; +}; + bool WebPluginImpl::initialize(WebPluginContainer* container) { if (!page_delegate_) return false; diff --git a/webkit/glue/plugins/webplugin_impl.h b/webkit/glue/plugins/webplugin_impl.h index 5fe96d2..cb0970b 100644 --- a/webkit/glue/plugins/webplugin_impl.h +++ b/webkit/glue/plugins/webplugin_impl.h @@ -11,7 +11,6 @@ #include "base/basictypes.h" #include "base/file_path.h" -#include "base/linked_ptr.h" #include "base/task.h" #include "base/weak_ptr.h" #include "gfx/native_widget_types.h" @@ -256,13 +255,7 @@ class WebPluginImpl : public WebPlugin, // Delayed task for downloading the plugin source URL. void OnDownloadPluginSrcUrl(); - struct ClientInfo { - unsigned long id; - WebPluginResourceClient* client; - WebKit::WebURLRequest request; - bool pending_failure_notification; - linked_ptr<WebKit::WebURLLoader> loader; - }; + struct ClientInfo; // Helper functions WebPluginResourceClient* GetClientFromLoader(WebKit::WebURLLoader* loader); |