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
diff --git a/chrome/browser/history/history_types.cc b/chrome/browser/history/history_types.cc
index 8a8ce6d0..45911305 100644
--- a/chrome/browser/history/history_types.cc
+++ b/chrome/browser/history/history_types.cc
@@ -95,6 +95,14 @@
VisitRow::~VisitRow() {
}
+// Favicons -------------------------------------------------------------------
+
+ImportedFavIconUsage::ImportedFavIconUsage() {
+}
+
+ImportedFavIconUsage::~ImportedFavIconUsage() {
+}
+
// StarredEntry ----------------------------------------------------------------
StarredEntry::StarredEntry()
@@ -292,6 +300,33 @@
}
}
+// QueryOptions ----------------------------------------------------------------
+
+QueryOptions::QueryOptions() : max_count(0) {}
+
+void QueryOptions::SetRecentDayRange(int days_ago) {
+ end_time = base::Time::Now();
+ begin_time = end_time - base::TimeDelta::FromDays(days_ago);
+}
+
+// KeywordSearchTermVisit -----------------------------------------------------
+
+KeywordSearchTermVisit::KeywordSearchTermVisit() {
+}
+
+KeywordSearchTermVisit::~KeywordSearchTermVisit() {
+}
+
+// Images ---------------------------------------------------------------------
+
+Images::Images() {
+}
+
+Images::~Images() {
+}
+
+// HistoryAddPageArgs ---------------------------------------------------------
+
HistoryAddPageArgs::HistoryAddPageArgs(
const GURL& arg_url,
base::Time arg_time,
diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h
index 8fab602..b479cbc 100644
--- a/chrome/browser/history/history_types.h
+++ b/chrome/browser/history/history_types.h
@@ -242,6 +242,9 @@
// Used by the importer to set favicons for imported bookmarks.
struct ImportedFavIconUsage {
+ ImportedFavIconUsage();
+ ~ImportedFavIconUsage();
+
// The URL of the favicon.
GURL favicon_url;
@@ -479,7 +482,7 @@
// QueryOptions ----------------------------------------------------------------
struct QueryOptions {
- QueryOptions() : max_count(0) {}
+ QueryOptions();
// The time range to search for matches in.
//
@@ -497,10 +500,7 @@
base::Time end_time;
// Sets the query time to the last |days_ago| days to the present time.
- void SetRecentDayRange(int days_ago) {
- end_time = base::Time::Now();
- begin_time = end_time - base::TimeDelta::FromDays(days_ago);
- }
+ void SetRecentDayRange(int days_ago);
// The maximum number of results to return. The results will be sorted with
// the most recent first, so older results may not be returned if there is not
@@ -513,6 +513,9 @@
// KeywordSearchTermVisit is returned from GetMostRecentKeywordSearchTerms. It
// gives the time and search term of the keyword visit.
struct KeywordSearchTermVisit {
+ KeywordSearchTermVisit();
+ ~KeywordSearchTermVisit();
+
// The time of the visit.
base::Time time;
@@ -537,6 +540,9 @@
// Used by TopSites to store the thumbnails.
struct Images {
+ Images();
+ ~Images();
+
scoped_refptr<RefCountedBytes> thumbnail;
ThumbnailScore thumbnail_score;
diff --git a/chrome/browser/history/snippet.cc b/chrome/browser/history/snippet.cc
index 6e3e93c..47c11c3 100644
--- a/chrome/browser/history/snippet.cc
+++ b/chrome/browser/history/snippet.cc
@@ -200,6 +200,12 @@
}
}
+Snippet::Snippet() {
+}
+
+Snippet::~Snippet() {
+}
+
void Snippet::ComputeSnippet(const MatchPositions& match_positions,
const std::string& document) {
// The length of snippets we try to produce.
@@ -284,3 +290,8 @@
utext_close(document_utext);
swap(text_, snippet);
}
+
+void Snippet::Swap(Snippet* other) {
+ text_.swap(other->text_);
+ matches_.swap(other->matches_);
+}
diff --git a/chrome/browser/history/snippet.h b/chrome/browser/history/snippet.h
index ffa8fa1..bbabef0 100644
--- a/chrome/browser/history/snippet.h
+++ b/chrome/browser/history/snippet.h
@@ -43,6 +43,9 @@
const std::string& utf8_string,
Snippet::MatchPositions* match_positions);
+ Snippet();
+ ~Snippet();
+
// Given |matches|, the match positions within |document|, compute the snippet
// for the document.
// Note that |document| is UTF-8 and the offsets in |matches| are byte
@@ -54,10 +57,7 @@
const MatchPositions& matches() const { return matches_; }
// Efficiently swaps the contents of this snippet with the other.
- void Swap(Snippet* other) {
- text_.swap(other->text_);
- matches_.swap(other->matches_);
- }
+ void Swap(Snippet* other);
private:
// The text of the snippet.
diff --git a/chrome/browser/importer/importer_bridge.cc b/chrome/browser/importer/importer_bridge.cc
index 079ebe3..3a95080 100644
--- a/chrome/browser/importer/importer_bridge.cc
+++ b/chrome/browser/importer/importer_bridge.cc
@@ -21,6 +21,10 @@
#include "chrome/profile_import/profile_import_thread.h"
#include "webkit/glue/password_form.h"
+ImporterBridge::ImporterBridge() { }
+
+ImporterBridge::~ImporterBridge() { }
+
InProcessImporterBridge::InProcessImporterBridge(ProfileWriter* writer,
ImporterHost* host)
: writer_(writer), host_(host) {
@@ -116,6 +120,8 @@
return l10n_util::GetString(message_id);
}
+InProcessImporterBridge::~InProcessImporterBridge() {}
+
ExternalProcessImporterBridge::ExternalProcessImporterBridge(
ProfileImportThread* profile_import_thread,
const DictionaryValue& localized_strings)
@@ -194,3 +200,5 @@
localized_strings_->GetString(base::IntToString(message_id), &message);
return UTF16ToWideHack(message);
}
+
+ExternalProcessImporterBridge::~ExternalProcessImporterBridge() {}
diff --git a/chrome/browser/importer/importer_bridge.h b/chrome/browser/importer/importer_bridge.h
index 8b57ab07..191276b 100644
--- a/chrome/browser/importer/importer_bridge.h
+++ b/chrome/browser/importer/importer_bridge.h
@@ -24,7 +24,7 @@
class ImporterBridge : public base::RefCountedThreadSafe<ImporterBridge> {
public:
- ImporterBridge() { }
+ ImporterBridge();
virtual void AddBookmarkEntries(
const std::vector<ProfileWriter::BookmarkEntry>& bookmarks,
@@ -72,7 +72,7 @@
// the abstraction here and assume import is in-process.
friend class Toolbar5Importer;
- virtual ~ImporterBridge() {}
+ virtual ~ImporterBridge();
DISALLOW_COPY_AND_ASSIGN(ImporterBridge);
};
@@ -110,7 +110,7 @@
virtual std::wstring GetLocalizedString(int message_id);
private:
- ~InProcessImporterBridge() {}
+ virtual ~InProcessImporterBridge();
ProfileWriter* const writer_; // weak
ImporterHost* const host_; // weak
@@ -156,7 +156,7 @@
virtual std::wstring GetLocalizedString(int message_id);
private:
- ~ExternalProcessImporterBridge() {}
+ ~ExternalProcessImporterBridge();
// Call back to send data and messages across IPC.
ProfileImportThread* const profile_import_thread_;
diff --git a/chrome/browser/importer/importer_data_types.cc b/chrome/browser/importer/importer_data_types.cc
new file mode 100644
index 0000000..3b327a9f
--- /dev/null
+++ b/chrome/browser/importer/importer_data_types.cc
@@ -0,0 +1,15 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/importer/importer_data_types.h"
+
+namespace importer {
+
+ProfileInfo::ProfileInfo() {
+}
+
+ProfileInfo::~ProfileInfo() {
+}
+
+} // namespace importer
diff --git a/chrome/browser/importer/importer_data_types.h b/chrome/browser/importer/importer_data_types.h
index e4af8fb..f937d40 100644
--- a/chrome/browser/importer/importer_data_types.h
+++ b/chrome/browser/importer/importer_data_types.h
@@ -46,6 +46,9 @@
// Information about a profile needed by an importer to do import work.
struct ProfileInfo {
+ ProfileInfo();
+ ~ProfileInfo();
+
std::wstring description;
importer::ProfileType browser_type;
FilePath source_path;
diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc
index 93d62488..57ddffc5 100644
--- a/chrome/browser/importer/profile_writer.cc
+++ b/chrome/browser/importer/profile_writer.cc
@@ -19,6 +19,12 @@
using webkit_glue::PasswordForm;
+ProfileWriter::BookmarkEntry::BookmarkEntry() : in_toolbar(false) {}
+
+ProfileWriter::BookmarkEntry::~BookmarkEntry() {}
+
+ProfileWriter::ProfileWriter(Profile* profile) : profile_(profile) {}
+
bool ProfileWriter::BookmarkModelIsLoaded() const {
return profile_->GetBookmarkModel()->IsLoaded();
}
@@ -277,6 +283,8 @@
}
}
+ProfileWriter::~ProfileWriter() {}
+
std::wstring ProfileWriter::GenerateUniqueFolderName(
BookmarkModel* model,
const std::wstring& folder_name) {
diff --git a/chrome/browser/importer/profile_writer.h b/chrome/browser/importer/profile_writer.h
index a8571cb..5c0e25c 100644
--- a/chrome/browser/importer/profile_writer.h
+++ b/chrome/browser/importer/profile_writer.h
@@ -48,19 +48,13 @@
BOOKMARK_BAR_DISABLED = 1 << 2
};
- explicit ProfileWriter(Profile* profile) : profile_(profile) {}
-
- // These functions return true if the corresponding model has been loaded.
- // If the models haven't been loaded, the importer waits to run until they've
- // completed.
- virtual bool BookmarkModelIsLoaded() const;
- virtual bool TemplateURLModelIsLoaded() const;
-
// A bookmark entry.
// TODO(mirandac): remove instances of wstring from ProfileWriter
// (http://crbug.com/43460).
struct BookmarkEntry {
- BookmarkEntry() : in_toolbar(false) {}
+ BookmarkEntry();
+ ~BookmarkEntry();
+
bool in_toolbar;
GURL url;
std::vector<std::wstring> path;
@@ -68,6 +62,14 @@
base::Time creation_time;
};
+ explicit ProfileWriter(Profile* profile);
+
+ // These functions return true if the corresponding model has been loaded.
+ // If the models haven't been loaded, the importer waits to run until they've
+ // completed.
+ virtual bool BookmarkModelIsLoaded() const;
+ virtual bool TemplateURLModelIsLoaded() const;
+
// Helper methods for adding data to local stores.
virtual void AddPasswordForm(const webkit_glue::PasswordForm& form);
#if defined(OS_WIN)
@@ -115,7 +117,7 @@
protected:
friend class base::RefCountedThreadSafe<ProfileWriter>;
- virtual ~ProfileWriter() {}
+ virtual ~ProfileWriter();
private:
// Generates a unique folder name. If folder_name is not unique, then this
diff --git a/chrome/browser/profile_import_process_host.cc b/chrome/browser/profile_import_process_host.cc
index a5b84ee..7cc58b32 100644
--- a/chrome/browser/profile_import_process_host.cc
+++ b/chrome/browser/profile_import_process_host.cc
@@ -24,6 +24,9 @@
thread_id_(thread_id) {
}
+ProfileImportProcessHost::~ProfileImportProcessHost() {
+}
+
bool ProfileImportProcessHost::StartProfileImportProcess(
const importer::ProfileInfo& profile_info, int items,
bool import_to_bookmark_bar) {
@@ -132,6 +135,20 @@
&ImportProcessClient::OnProcessCrashed));
}
+bool ProfileImportProcessHost::CanShutdown() {
+ return true;
+}
+
+URLRequestContext* ProfileImportProcessHost::GetRequestContext(
+ uint32 request_id,
+ const ViewHostMsg_Resource_Request& request_data) {
+ return NULL;
+}
+
+ProfileImportProcessHost::ImportProcessClient::ImportProcessClient() {}
+
+ProfileImportProcessHost::ImportProcessClient::~ImportProcessClient() {}
+
void ProfileImportProcessHost::ImportProcessClient::OnMessageReceived(
const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(ProfileImportProcessHost, message)
diff --git a/chrome/browser/profile_import_process_host.h b/chrome/browser/profile_import_process_host.h
index 8b0d9a3..22e0026 100644
--- a/chrome/browser/profile_import_process_host.h
+++ b/chrome/browser/profile_import_process_host.h
@@ -35,7 +35,7 @@
class ImportProcessClient :
public base::RefCountedThreadSafe<ImportProcessClient> {
public:
- ImportProcessClient() {}
+ ImportProcessClient();
// These methods are used by the ProfileImportProcessHost to pass messages
// received from the external process back to the ImportProcessClient in
@@ -79,7 +79,7 @@
protected:
friend class base::RefCountedThreadSafe<ImportProcessClient>;
- virtual ~ImportProcessClient() {}
+ virtual ~ImportProcessClient();
private:
friend class ProfileImportProcessHost;
@@ -98,6 +98,7 @@
ProfileImportProcessHost(ResourceDispatcherHost* resource_dispatcher,
ImportProcessClient* import_process_client,
ChromeThread::ID thread_id);
+ virtual ~ProfileImportProcessHost();
// |profile_info|, |items|, and |import_to_bookmark_bar| are all needed by
// the external importer process.
@@ -126,12 +127,10 @@
// Overridden from BrowserChildProcessHost:
virtual void OnProcessCrashed();
- virtual bool CanShutdown() { return true; }
+ virtual bool CanShutdown();
virtual URLRequestContext* GetRequestContext(
uint32 request_id,
- const ViewHostMsg_Resource_Request& request_data) {
- return NULL;
- }
+ const ViewHostMsg_Resource_Request& request_data);
// Receives messages to be passed back to the importer host.
scoped_refptr<ImportProcessClient> import_process_client_;
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 5db948f..90bef1d 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1987,6 +1987,7 @@
'browser/importer/importer.h',
'browser/importer/importer_bridge.cc',
'browser/importer/importer_bridge.h',
+ 'browser/importer/importer_data_types.cc',
'browser/importer/importer_data_types.h',
'browser/importer/importer_list.cc',
'browser/importer/importer_list.h',
diff --git a/chrome/common/net/gaia/gaia_authenticator.cc b/chrome/common/net/gaia/gaia_authenticator.cc
index f544e94..7a7322c 100644
--- a/chrome/common/net/gaia/gaia_authenticator.cc
+++ b/chrome/common/net/gaia/gaia_authenticator.cc
@@ -26,6 +26,14 @@
static const char kGetUserInfoPath[] = "/accounts/GetUserInfo";
+GaiaAuthenticator::AuthResults::AuthResults() : auth_error(None) {}
+
+GaiaAuthenticator::AuthResults::~AuthResults() {}
+
+GaiaAuthenticator::AuthParams::AuthParams() {}
+
+GaiaAuthenticator::AuthParams::~AuthParams() {}
+
// Sole constructor with initializers for all fields.
GaiaAuthenticator::GaiaAuthenticator(const string& user_agent,
const string& service_id,
diff --git a/chrome/common/net/gaia/gaia_authenticator.h b/chrome/common/net/gaia/gaia_authenticator.h
index 696f403..789863e 100644
--- a/chrome/common/net/gaia/gaia_authenticator.h
+++ b/chrome/common/net/gaia/gaia_authenticator.h
@@ -131,6 +131,9 @@
void SetAuthToken(const std::string& auth_token);
struct AuthResults {
+ AuthResults();
+ ~AuthResults();
+
std::string email;
std::string password;
@@ -147,13 +150,14 @@
std::string auth_error_url;
std::string captcha_token;
std::string captcha_url;
-
- AuthResults() : auth_error(None) {}
};
protected:
struct AuthParams {
+ AuthParams();
+ ~AuthParams();
+
GaiaAuthenticator* authenticator;
uint32 request_id;
std::string email;
diff --git a/chrome/common/net/url_fetcher_protect.cc b/chrome/common/net/url_fetcher_protect.cc
index 05c8e2e2..f078fd4 100644
--- a/chrome/common/net/url_fetcher_protect.cc
+++ b/chrome/common/net/url_fetcher_protect.cc
@@ -52,6 +52,8 @@
ResetBackoff();
}
+URLFetcherProtectEntry::~URLFetcherProtectEntry() {}
+
int64 URLFetcherProtectEntry::UpdateBackoff(EventType event_type) {
// request may be sent in different threads
AutoLock lock(lock_);
@@ -174,3 +176,5 @@
services_[id] = entry;
return entry;
}
+
+URLFetcherProtectManager::URLFetcherProtectManager() {}
diff --git a/chrome/common/net/url_fetcher_protect.h b/chrome/common/net/url_fetcher_protect.h
index 980353c..6372640f 100644
--- a/chrome/common/net/url_fetcher_protect.h
+++ b/chrome/common/net/url_fetcher_protect.h
@@ -48,7 +48,7 @@
int maximum_timeout);
- virtual ~URLFetcherProtectEntry() { }
+ virtual ~URLFetcherProtectEntry();
// When a connection event happens, log it to the queue, and recalculate
// the timeout period. It returns the backoff time, in milliseconds, that
@@ -138,7 +138,7 @@
URLFetcherProtectEntry* entry);
private:
- URLFetcherProtectManager() { }
+ URLFetcherProtectManager();
typedef std::map<const std::string, URLFetcherProtectEntry*> ProtectService;
diff --git a/chrome/common/net/url_request_context_getter.cc b/chrome/common/net/url_request_context_getter.cc
index e58b7947..c53f782 100644
--- a/chrome/common/net/url_request_context_getter.cc
+++ b/chrome/common/net/url_request_context_getter.cc
@@ -10,6 +10,10 @@
return GetURLRequestContext()->cookie_store();
}
+URLRequestContextGetter::URLRequestContextGetter() {}
+
+URLRequestContextGetter::~URLRequestContextGetter() {}
+
void URLRequestContextGetter::OnDestruct() {
scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy =
GetIOMessageLoopProxy();
diff --git a/chrome/common/net/url_request_context_getter.h b/chrome/common/net/url_request_context_getter.h
index 34aa668..89b28b5 100644
--- a/chrome/common/net/url_request_context_getter.h
+++ b/chrome/common/net/url_request_context_getter.h
@@ -39,7 +39,9 @@
friend class DeleteTask<URLRequestContextGetter>;
friend struct URLRequestContextGetterTraits;
- virtual ~URLRequestContextGetter() {}
+ URLRequestContextGetter();
+ virtual ~URLRequestContextGetter();
+
private:
// OnDestruct is meant to ensure deletion on the thread on which the request
// IO happens.
diff --git a/chrome/common/web_resource/web_resource_unpacker.cc b/chrome/common/web_resource/web_resource_unpacker.cc
index bbb14cf..e93ea36 100644
--- a/chrome/common/web_resource/web_resource_unpacker.cc
+++ b/chrome/common/web_resource/web_resource_unpacker.cc
@@ -13,6 +13,13 @@
const char* WebResourceUnpacker::kUnexpectedJSONFormatError =
"Data from web resource server does not have expected format.";
+WebResourceUnpacker::WebResourceUnpacker(const std::string &resource_data)
+ : resource_data_(resource_data) {
+}
+
+WebResourceUnpacker::~WebResourceUnpacker() {
+}
+
// TODO(mrc): Right now, this reads JSON data from the experimental popgadget
// server. Change so the format is based on a template, once we have
// decided on final server format.
diff --git a/chrome/common/web_resource/web_resource_unpacker.h b/chrome/common/web_resource/web_resource_unpacker.h
index c49f2fa..0728c2c 100644
--- a/chrome/common/web_resource/web_resource_unpacker.h
+++ b/chrome/common/web_resource/web_resource_unpacker.h
@@ -25,8 +25,8 @@
static const char* kInvalidDataTypeError;
static const char* kUnexpectedJSONFormatError;
- explicit WebResourceUnpacker(const std::string &resource_data)
- : resource_data_(resource_data) {}
+ explicit WebResourceUnpacker(const std::string &resource_data);
+ ~WebResourceUnpacker();
// This does the actual parsing. In case of an error, error_message_
// is set to an appropriate value.