diff options
69 files changed, 557 insertions, 315 deletions
diff --git a/app/table_model.cc b/app/table_model.cc index b70ad2d..821e14c 100644 --- a/app/table_model.cc +++ b/app/table_model.cc @@ -6,6 +6,7 @@ #include "app/l10n_util.h" #include "app/l10n_util_collator.h" +#include "base/logging.h" #include "third_party/skia/include/core/SkBitmap.h" // TableColumn ----------------------------------------------------------------- @@ -75,6 +76,28 @@ SkBitmap TableModel::GetIcon(int row) { return SkBitmap(); } +std::wstring TableModel::GetTooltip(int row) { + return std::wstring(); +} + +bool TableModel::HasGroups() { + return false; +} + +TableModel::Groups TableModel::GetGroups() { + // If you override HasGroups to return true, you must override this as + // well. + NOTREACHED(); + return std::vector<Group>(); +} + +int TableModel::GetGroupID(int row) { + // If you override HasGroups to return true, you must override this as + // well. + NOTREACHED(); + return 0; +} + int TableModel::CompareValues(int row1, int row2, int column_id) { DCHECK(row1 >= 0 && row1 < RowCount() && row2 >= 0 && row2 < RowCount()); diff --git a/app/table_model.h b/app/table_model.h index 60637f0..baae390 100644 --- a/app/table_model.h +++ b/app/table_model.h @@ -9,7 +9,6 @@ #include <string> #include <vector> -#include "base/logging.h" #include "unicode/coll.h" class SkBitmap; @@ -44,9 +43,7 @@ class TableModel { // Returns the tooltip, if any, to show for a particular row. If there are // multiple columns in the row, this will only be shown when hovering over // column zero. - virtual std::wstring GetTooltip(int row) { - return std::wstring(); - } + virtual std::wstring GetTooltip(int row); // Returns true if the TableView has groups. Groups provide a way to visually // delineate the rows in a table view. When groups are enabled table view @@ -54,25 +51,15 @@ class TableModel { // the group. // // On win2k a visual separator is not rendered for the group headers. - virtual bool HasGroups() { return false; } + virtual bool HasGroups(); // Returns the groups. // This is only used if HasGroups returns true. - virtual Groups GetGroups() { - // If you override HasGroups to return true, you must override this as - // well. - NOTREACHED(); - return std::vector<Group>(); - } + virtual Groups GetGroups(); // Returns the group id of the specified row. // This is only used if HasGroups returns true. - virtual int GetGroupID(int row) { - // If you override HasGroups to return true, you must override this as - // well. - NOTREACHED(); - return 0; - } + virtual int GetGroupID(int row); // Sets the observer for the model. The TableView should NOT take ownership // of the observer. diff --git a/app/tree_node_model.h b/app/tree_node_model.h index ac6475b..3f21971 100644 --- a/app/tree_node_model.h +++ b/app/tree_node_model.h @@ -11,6 +11,7 @@ #include "app/tree_model.h" #include "base/basictypes.h" +#include "base/logging.h" #include "base/observer_list.h" #include "base/scoped_ptr.h" #include "base/scoped_vector.h" diff --git a/base/base.gypi b/base/base.gypi index d594972..3c5e1a0 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -221,6 +221,7 @@ 'singleton.h', 'spin_wait.h', 'stack_container.h', + 'stats_counters.cc', 'stats_counters.h', 'stats_table.cc', 'stats_table.h', diff --git a/base/stats_counters.cc b/base/stats_counters.cc new file mode 100644 index 0000000..345e1d6 --- /dev/null +++ b/base/stats_counters.cc @@ -0,0 +1,113 @@ +// 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 "base/stats_counters.h" + +StatsCounter::StatsCounter(const std::string& name) + : counter_id_(-1) { + // We prepend the name with 'c:' to indicate that it is a counter. + name_ = "c:"; + name_.append(name); +} + +StatsCounter::~StatsCounter() { +} + +void StatsCounter::Set(int value) { + int* loc = GetPtr(); + if (loc) + *loc = value; +} + +void StatsCounter::Add(int value) { + int* loc = GetPtr(); + if (loc) + (*loc) += value; +} + +StatsCounter::StatsCounter() + : counter_id_(-1) { +} + +int* StatsCounter::GetPtr() { + StatsTable* table = StatsTable::current(); + if (!table) + return NULL; + + // If counter_id_ is -1, then we haven't looked it up yet. + if (counter_id_ == -1) { + counter_id_ = table->FindCounter(name_); + if (table->GetSlot() == 0) { + if (!table->RegisterThread("")) { + // There is no room for this thread. This thread + // cannot use counters. + counter_id_ = 0; + return NULL; + } + } + } + + // If counter_id_ is > 0, then we have a valid counter. + if (counter_id_ > 0) + return table->GetLocation(counter_id_, table->GetSlot()); + + // counter_id_ was zero, which means the table is full. + return NULL; +} + + +StatsCounterTimer::StatsCounterTimer(const std::string& name) { + // we prepend the name with 't:' to indicate that it is a timer. + name_ = "t:"; + name_.append(name); +} + +StatsCounterTimer::~StatsCounterTimer() { +} + +void StatsCounterTimer::Start() { + if (!Enabled()) + return; + start_time_ = base::TimeTicks::Now(); + stop_time_ = base::TimeTicks(); +} + +// Stop the timer and record the results. +void StatsCounterTimer::Stop() { + if (!Enabled() || !Running()) + return; + stop_time_ = base::TimeTicks::Now(); + Record(); +} + +// Returns true if the timer is running. +bool StatsCounterTimer::Running() { + return Enabled() && !start_time_.is_null() && stop_time_.is_null(); +} + +// Accept a TimeDelta to increment. +void StatsCounterTimer::AddTime(base::TimeDelta time) { + Add(static_cast<int>(time.InMilliseconds())); +} + +void StatsCounterTimer::Record() { + AddTime(stop_time_ - start_time_); +} + + +StatsRate::StatsRate(const char* name) + : StatsCounterTimer(name), + counter_(name), + largest_add_(std::string(" ").append(name).append("MAX").c_str()) { +} + +StatsRate::~StatsRate() { +} + +void StatsRate::Add(int value) { + counter_.Increment(); + StatsCounterTimer::Add(value); + if (value > largest_add_.value()) + largest_add_.Set(value); +} diff --git a/base/stats_counters.h b/base/stats_counters.h index b328736..defb9ee 100644 --- a/base/stats_counters.h +++ b/base/stats_counters.h @@ -75,31 +75,18 @@ class StatsCounter { public: // Create a StatsCounter object. - explicit StatsCounter(const std::string& name) - : counter_id_(-1) { - // We prepend the name with 'c:' to indicate that it is a counter. - name_ = "c:"; - name_.append(name); - }; - - virtual ~StatsCounter() {} + explicit StatsCounter(const std::string& name); + virtual ~StatsCounter(); // Sets the counter to a specific value. - void Set(int value) { - int* loc = GetPtr(); - if (loc) *loc = value; - } + void Set(int value); // Increments the counter. void Increment() { Add(1); } - virtual void Add(int value) { - int* loc = GetPtr(); - if (loc) - (*loc) += value; - } + virtual void Add(int value); // Decrements the counter. void Decrement() { @@ -123,36 +110,10 @@ class StatsCounter { } protected: - StatsCounter() - : counter_id_(-1) { - } + StatsCounter(); // Returns the cached address of this counter location. - int* GetPtr() { - StatsTable* table = StatsTable::current(); - if (!table) - return NULL; - - // If counter_id_ is -1, then we haven't looked it up yet. - if (counter_id_ == -1) { - counter_id_ = table->FindCounter(name_); - if (table->GetSlot() == 0) { - if (!table->RegisterThread("")) { - // There is no room for this thread. This thread - // cannot use counters. - counter_id_ = 0; - return NULL; - } - } - } - - // If counter_id_ is > 0, then we have a valid counter. - if (counter_id_ > 0) - return table->GetLocation(counter_id_, table->GetSlot()); - - // counter_id_ was zero, which means the table is full. - return NULL; - } + int* GetPtr(); std::string name_; // The counter id in the table. We initialize to -1 (an invalid value) @@ -168,43 +129,24 @@ class StatsCounter { class StatsCounterTimer : protected StatsCounter { public: // Constructs and starts the timer. - explicit StatsCounterTimer(const std::string& name) { - // we prepend the name with 't:' to indicate that it is a timer. - name_ = "t:"; - name_.append(name); - } + explicit StatsCounterTimer(const std::string& name); + virtual ~StatsCounterTimer(); // Start the timer. - void Start() { - if (!Enabled()) - return; - start_time_ = base::TimeTicks::Now(); - stop_time_ = base::TimeTicks(); - } + void Start(); // Stop the timer and record the results. - void Stop() { - if (!Enabled() || !Running()) - return; - stop_time_ = base::TimeTicks::Now(); - Record(); - } + void Stop(); // Returns true if the timer is running. - bool Running() { - return Enabled() && !start_time_.is_null() && stop_time_.is_null(); - } + bool Running(); // Accept a TimeDelta to increment. - virtual void AddTime(base::TimeDelta time) { - Add(static_cast<int>(time.InMilliseconds())); - } + virtual void AddTime(base::TimeDelta time); protected: // Compute the delta between start and stop, in milliseconds. - void Record() { - AddTime(stop_time_ - start_time_); - } + void Record(); base::TimeTicks start_time_; base::TimeTicks stop_time_; @@ -216,18 +158,10 @@ class StatsCounterTimer : protected StatsCounter { class StatsRate : public StatsCounterTimer { public: // Constructs and starts the timer. - explicit StatsRate(const char* name) - : StatsCounterTimer(name), - counter_(name), - largest_add_(std::string(" ").append(name).append("MAX").c_str()) { - } + explicit StatsRate(const char* name); + virtual ~StatsRate(); - virtual void Add(int value) { - counter_.Increment(); - StatsCounterTimer::Add(value); - if (value > largest_add_.value()) - largest_add_.Set(value); - } + virtual void Add(int value); private: StatsCounter counter_; diff --git a/base/watchdog.cc b/base/watchdog.cc index d78ec0c..b20d9fa 100644 --- a/base/watchdog.cc +++ b/base/watchdog.cc @@ -5,6 +5,7 @@ #include "base/watchdog.h" #include "base/compiler_specific.h" +#include "base/logging.h" #include "base/platform_thread.h" using base::TimeDelta; @@ -72,6 +73,10 @@ void Watchdog::Disarm() { // will check its state and time, and act accordingly. } +void Watchdog::Alarm() { + DLOG(INFO) << "Watchdog alarmed for " << thread_watched_name_; +} + //------------------------------------------------------------------------------ // Internal private methods that the watchdog thread uses. diff --git a/base/watchdog.h b/base/watchdog.h index fd8f444..b4262d4 100644 --- a/base/watchdog.h +++ b/base/watchdog.h @@ -23,7 +23,6 @@ #include "base/condition_variable.h" #include "base/lock.h" -#include "base/logging.h" #include "base/platform_thread.h" #include "base/time.h" @@ -45,9 +44,7 @@ class Watchdog { // Alarm is called if the time expires after an Arm() without someone calling // Disarm(). This method can be overridden to create testable classes. - virtual void Alarm() { - DLOG(INFO) << "Watchdog alarmed for " << thread_watched_name_; - } + virtual void Alarm(); // Reset static data to initial state. Useful for tests, to ensure // they are independent. diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc index c23c5ab..7a63c48 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc @@ -431,6 +431,10 @@ int AutocompleteEditViewGtk::GetIcon() const { toolbar_model_->GetIcon(); } +void AutocompleteEditViewGtk::SetUserText(const std::wstring& text) { + SetUserText(text, text, true); +} + void AutocompleteEditViewGtk::SetUserText(const std::wstring& text, const std::wstring& display_text, bool update_popup) { diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h index ba014f1..92c0f77 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h @@ -107,9 +107,7 @@ class AutocompleteEditViewGtk : public AutocompleteEditView, virtual bool IsEditingOrEmpty() const; virtual int GetIcon() const; - virtual void SetUserText(const std::wstring& text) { - SetUserText(text, text, true); - } + virtual void SetUserText(const std::wstring& text); virtual void SetUserText(const std::wstring& text, const std::wstring& display_text, bool update_popup); diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h index d3c2570..a474ce0 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h @@ -49,9 +49,7 @@ class AutocompleteEditViewMac : public AutocompleteEditView, virtual bool IsEditingOrEmpty() const; virtual int GetIcon() const; - virtual void SetUserText(const std::wstring& text) { - SetUserText(text, text, true); - } + virtual void SetUserText(const std::wstring& text); virtual void SetUserText(const std::wstring& text, const std::wstring& display_text, bool update_popup); diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm index 499b031..0c2646e 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm @@ -301,6 +301,10 @@ int AutocompleteEditViewMac::GetIcon() const { toolbar_model_->GetIcon(); } +void AutocompleteEditViewMac::SetUserText(const std::wstring& text) { + SetUserText(text, text, true); +} + void AutocompleteEditViewMac::SetUserText(const std::wstring& text, const std::wstring& display_text, bool update_popup) { diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index 37419d1..9660ecb 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -629,6 +629,10 @@ int AutocompleteEditViewWin::GetIcon() const { toolbar_model_->GetIcon(); } +void AutocompleteEditViewWin::SetUserText(const std::wstring& text) { + SetUserText(text, text, true); +} + void AutocompleteEditViewWin::SetUserText(const std::wstring& text, const std::wstring& display_text, bool update_popup) { diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.h b/chrome/browser/autocomplete/autocomplete_edit_view_win.h index a993d80..c0abab6 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.h @@ -106,9 +106,7 @@ class AutocompleteEditViewWin virtual bool IsEditingOrEmpty() const; virtual int GetIcon() const; - virtual void SetUserText(const std::wstring& text) { - SetUserText(text, text, true); - } + virtual void SetUserText(const std::wstring& text); virtual void SetUserText(const std::wstring& text, const std::wstring& display_text, bool update_popup); diff --git a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc b/chrome/browser/autofill/autofill_cc_infobar_delegate.cc index 364bc3f..2dadc7d 100644 --- a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc +++ b/chrome/browser/autofill/autofill_cc_infobar_delegate.cc @@ -103,3 +103,6 @@ InfoBar* AutoFillCCInfoBarDelegate::CreateInfoBar() { } #endif // defined(OS_WIN) +InfoBarDelegate::Type AutoFillCCInfoBarDelegate::GetInfoBarType() { + return PAGE_ACTION_TYPE; +} diff --git a/chrome/browser/autofill/autofill_cc_infobar_delegate.h b/chrome/browser/autofill/autofill_cc_infobar_delegate.h index 6880b62..a02b4ca 100644 --- a/chrome/browser/autofill/autofill_cc_infobar_delegate.h +++ b/chrome/browser/autofill/autofill_cc_infobar_delegate.h @@ -39,9 +39,7 @@ class AutoFillCCInfoBarDelegate : public ConfirmInfoBarDelegate { virtual InfoBar* CreateInfoBar(); #endif // defined(OS_WIN) - virtual Type GetInfoBarType() { - return PAGE_ACTION_TYPE; - } + virtual Type GetInfoBarType(); private: // The AutoFillManager that initiated this InfoBar. diff --git a/chrome/browser/browsing_instance.cc b/chrome/browser/browsing_instance.cc index 41a3abc..ec433b7 100644 --- a/chrome/browser/browsing_instance.cc +++ b/chrome/browser/browsing_instance.cc @@ -5,6 +5,7 @@ #include "chrome/browser/browsing_instance.h" #include "base/command_line.h" +#include "base/logging.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/site_instance.h" #include "chrome/common/chrome_switches.h" @@ -14,6 +15,10 @@ BrowsingInstance::ProfileSiteInstanceMap BrowsingInstance::profile_site_instance_map_; +BrowsingInstance::BrowsingInstance(Profile* profile) + : profile_(profile) { +} + bool BrowsingInstance::ShouldUseProcessPerSite(const GURL& url) { // Returns true if we should use the process-per-site model. This will be // the case if the --process-per-site switch is specified, or in @@ -123,3 +128,9 @@ void BrowsingInstance::UnregisterSiteInstance(SiteInstance* site_instance) { map->erase(i); } } + +BrowsingInstance::~BrowsingInstance() { + // We should only be deleted when all of the SiteInstances that refer to + // us are gone. + DCHECK(site_instance_map_.empty()); +} diff --git a/chrome/browser/browsing_instance.h b/chrome/browser/browsing_instance.h index 491888d..fa4ce49 100644 --- a/chrome/browser/browsing_instance.h +++ b/chrome/browser/browsing_instance.h @@ -7,7 +7,6 @@ #pragma once #include "base/hash_tables.h" -#include "base/logging.h" #include "base/ref_counted.h" #include "chrome/browser/profile.h" @@ -56,9 +55,7 @@ class SiteInstance; class BrowsingInstance : public base::RefCounted<BrowsingInstance> { public: // Create a new BrowsingInstance. - explicit BrowsingInstance(Profile* profile) - : profile_(profile) { - } + explicit BrowsingInstance(Profile* profile); // Returns whether the process-per-site model is in use (globally or just for // the given url), in which case we should ensure there is only one @@ -92,11 +89,7 @@ class BrowsingInstance : public base::RefCounted<BrowsingInstance> { friend class base::RefCounted<BrowsingInstance>; // Virtual to allow tests to extend it. - virtual ~BrowsingInstance() { - // We should only be deleted when all of the SiteInstances that refer to - // us are gone. - DCHECK(site_instance_map_.empty()); - } + virtual ~BrowsingInstance(); private: // Map of site to SiteInstance, to ensure we only have one SiteInstance per diff --git a/chrome/browser/cocoa/simple_content_exceptions_window_controller.mm b/chrome/browser/cocoa/simple_content_exceptions_window_controller.mm index a054b54..e61efa8 100644 --- a/chrome/browser/cocoa/simple_content_exceptions_window_controller.mm +++ b/chrome/browser/cocoa/simple_content_exceptions_window_controller.mm @@ -6,6 +6,7 @@ #include "app/l10n_util_mac.h" #include "app/table_model_observer.h" +#include "base/logging.h" #import "base/mac_util.h" #import "base/scoped_nsobject.h" #include "base/sys_string_conversions.h" diff --git a/chrome/browser/cocoa/table_model_array_controller.mm b/chrome/browser/cocoa/table_model_array_controller.mm index e88e6e1..fa2e570 100644 --- a/chrome/browser/cocoa/table_model_array_controller.mm +++ b/chrome/browser/cocoa/table_model_array_controller.mm @@ -5,6 +5,7 @@ #import "chrome/browser/cocoa/table_model_array_controller.h" #include "app/table_model.h" +#include "base/logging.h" #include "base/sys_string_conversions.h" #include "chrome/browser/remove_rows_table_model.h" diff --git a/chrome/browser/default_encoding_combo_model.cc b/chrome/browser/default_encoding_combo_model.cc index fe71b74..f900713 100644 --- a/chrome/browser/default_encoding_combo_model.cc +++ b/chrome/browser/default_encoding_combo_model.cc @@ -24,6 +24,13 @@ DefaultEncodingComboboxModel::DefaultEncodingComboboxModel() { l10n_util::SortVectorWithStringKey(locale, &sorted_encoding_list_, true); } +DefaultEncodingComboboxModel::~DefaultEncodingComboboxModel() { +} + +int DefaultEncodingComboboxModel::GetItemCount() { + return static_cast<int>(sorted_encoding_list_.size()); +} + string16 DefaultEncodingComboboxModel::GetItemAt(int index) { DCHECK(index >= 0 && index < GetItemCount()); return WideToUTF16Hack(sorted_encoding_list_[index].encoding_display_name); diff --git a/chrome/browser/default_encoding_combo_model.h b/chrome/browser/default_encoding_combo_model.h index 5283507..a4d5a50 100644 --- a/chrome/browser/default_encoding_combo_model.h +++ b/chrome/browser/default_encoding_combo_model.h @@ -17,12 +17,10 @@ class Profile; class DefaultEncodingComboboxModel : public ComboboxModel { public: DefaultEncodingComboboxModel(); - virtual ~DefaultEncodingComboboxModel() {} + virtual ~DefaultEncodingComboboxModel(); // Overridden from ComboboxModel. - virtual int GetItemCount() { - return static_cast<int>(sorted_encoding_list_.size()); - } + virtual int GetItemCount(); virtual string16 GetItemAt(int index); diff --git a/chrome/browser/device_orientation/provider.cc b/chrome/browser/device_orientation/provider.cc index 1ac0220..4091937 100644 --- a/chrome/browser/device_orientation/provider.cc +++ b/chrome/browser/device_orientation/provider.cc @@ -40,6 +40,14 @@ Provider* Provider::GetInstanceForTests() { return instance_; } +Provider::Provider() { +} + +Provider::~Provider() { + DCHECK(instance_ == this); + instance_ = NULL; +} + Provider* Provider::instance_ = NULL; } // namespace device_orientation diff --git a/chrome/browser/device_orientation/provider.h b/chrome/browser/device_orientation/provider.h index ce1b89d..8f19eb7 100644 --- a/chrome/browser/device_orientation/provider.h +++ b/chrome/browser/device_orientation/provider.h @@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_DEVICE_ORIENTATION_PROVIDER_H_ #define CHROME_BROWSER_DEVICE_ORIENTATION_PROVIDER_H_ -#include "base/logging.h" #include "base/ref_counted.h" namespace device_orientation { @@ -42,11 +41,8 @@ class Provider : public base::RefCountedThreadSafe<Provider> { virtual void RemoveObserver(Observer* observer) = 0; protected: - Provider() {} - virtual ~Provider() { - DCHECK(instance_ == this); - instance_ = NULL; - } + Provider(); + virtual ~Provider(); private: friend class base::RefCountedThreadSafe<Provider>; diff --git a/chrome/browser/extensions/crashed_extension_infobar.cc b/chrome/browser/extensions/crashed_extension_infobar.cc index b43f11b..053b4b4 100644 --- a/chrome/browser/extensions/crashed_extension_infobar.cc +++ b/chrome/browser/extensions/crashed_extension_infobar.cc @@ -25,6 +25,11 @@ CrashedExtensionInfoBarDelegate::CrashedExtensionInfoBarDelegate( DCHECK(!extension_id_.empty()); } +CrashedExtensionInfoBarDelegate* CrashedExtensionInfoBarDelegate:: +AsCrashedExtensionInfoBarDelegate() { + return this; +} + string16 CrashedExtensionInfoBarDelegate::GetMessageText() const { return l10n_util::GetStringFUTF16(IDS_EXTENSION_CRASHED_INFOBAR_MESSAGE, UTF8ToUTF16(extension_name_)); diff --git a/chrome/browser/extensions/crashed_extension_infobar.h b/chrome/browser/extensions/crashed_extension_infobar.h index 5387a0a..1508ae5 100644 --- a/chrome/browser/extensions/crashed_extension_infobar.h +++ b/chrome/browser/extensions/crashed_extension_infobar.h @@ -29,9 +29,7 @@ class CrashedExtensionInfoBarDelegate : public ConfirmInfoBarDelegate { const std::string extension_id() { return extension_id_; } // InfoBarDelegate - virtual CrashedExtensionInfoBarDelegate* AsCrashedExtensionInfoBarDelegate() { - return this; - } + virtual CrashedExtensionInfoBarDelegate* AsCrashedExtensionInfoBarDelegate(); // ConfirmInfoBarDelegate virtual string16 GetMessageText() const; diff --git a/chrome/browser/extensions/extension_cookies_api.cc b/chrome/browser/extensions/extension_cookies_api.cc index 81b0690..a1e455c 100644 --- a/chrome/browser/extensions/extension_cookies_api.cc +++ b/chrome/browser/extensions/extension_cookies_api.cc @@ -145,6 +145,8 @@ bool CookiesFunction::ParseStoreContext(const DictionaryValue* details, GetCookieFunction::GetCookieFunction() {} +GetCookieFunction::~GetCookieFunction() {} + bool GetCookieFunction::RunImpl() { // Return false if the arguments are malformed. DictionaryValue* details; @@ -210,6 +212,8 @@ void GetCookieFunction::RespondOnUIThread() { GetAllCookiesFunction::GetAllCookiesFunction() : details_(NULL) {} +GetAllCookiesFunction::~GetAllCookiesFunction() {} + bool GetAllCookiesFunction::RunImpl() { // Return false if the arguments are malformed. EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details_)); @@ -266,6 +270,9 @@ SetCookieFunction::SetCookieFunction() success_(false) { } +SetCookieFunction::~SetCookieFunction() { +} + bool SetCookieFunction::RunImpl() { // Return false if the arguments are malformed. DictionaryValue* details; @@ -408,6 +415,10 @@ bool RemoveCookieFunction::RunImpl() { return true; } +void RemoveCookieFunction::Run() { + SendResponse(RunImpl()); +} + bool GetAllCookieStoresFunction::RunImpl() { Profile* original_profile = profile(); DCHECK(original_profile); @@ -451,3 +462,7 @@ bool GetAllCookieStoresFunction::RunImpl() { result_.reset(cookie_store_list); return true; } + +void GetAllCookieStoresFunction::Run() { + SendResponse(RunImpl()); +} diff --git a/chrome/browser/extensions/extension_cookies_api.h b/chrome/browser/extensions/extension_cookies_api.h index 0ecb4e3..50b922b 100644 --- a/chrome/browser/extensions/extension_cookies_api.h +++ b/chrome/browser/extensions/extension_cookies_api.h @@ -94,6 +94,7 @@ class CookiesFunction : public AsyncExtensionFunction { class GetCookieFunction : public CookiesFunction { public: GetCookieFunction(); + ~GetCookieFunction(); virtual bool RunImpl(); DECLARE_EXTENSION_FUNCTION_NAME("cookies.get") @@ -112,6 +113,7 @@ class GetCookieFunction : public CookiesFunction { class GetAllCookiesFunction : public CookiesFunction { public: GetAllCookiesFunction(); + ~GetAllCookiesFunction(); virtual bool RunImpl(); DECLARE_EXTENSION_FUNCTION_NAME("cookies.getAll") @@ -130,6 +132,7 @@ class GetAllCookiesFunction : public CookiesFunction { class SetCookieFunction : public CookiesFunction { public: SetCookieFunction(); + ~SetCookieFunction(); virtual bool RunImpl(); DECLARE_EXTENSION_FUNCTION_NAME("cookies.set") @@ -154,9 +157,7 @@ class RemoveCookieFunction : public CookiesFunction { public: virtual bool RunImpl(); // RemoveCookieFunction is sync. - virtual void Run() { - SendResponse(RunImpl()); - } + virtual void Run(); DECLARE_EXTENSION_FUNCTION_NAME("cookies.remove") }; @@ -165,9 +166,7 @@ class GetAllCookieStoresFunction : public CookiesFunction { public: virtual bool RunImpl(); // GetAllCookieStoresFunction is sync. - virtual void Run() { - SendResponse(RunImpl()); - } + virtual void Run(); DECLARE_EXTENSION_FUNCTION_NAME("cookies.getAllCookieStores") }; diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index f913732..0acc018 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -212,6 +212,14 @@ void ExtensionHost::CreateRenderViewNow() { DCHECK(IsRenderViewLive()); } +Browser* ExtensionHost::GetBrowser() const { + return view() ? view()->browser() : NULL; +} + +gfx::NativeView ExtensionHost::GetNativeViewOfHost() { + return view() ? view()->native_view() : NULL; +} + void ExtensionHost::NavigateToURL(const GURL& url) { // Prevent explicit navigation to another extension id's pages. // This method is only called by some APIs, so we still need to protect diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index ea92c72..358daeb 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -212,12 +212,8 @@ class ExtensionHost : public RenderViewHostDelegate, void CreateRenderViewNow(); // ExtensionFunctionDispatcher::Delegate - virtual Browser* GetBrowser() const { - return view() ? view()->browser() : NULL; - } - virtual gfx::NativeView GetNativeViewOfHost() { - return view() ? view()->native_view() : NULL; - } + virtual Browser* GetBrowser() const; + virtual gfx::NativeView GetNativeViewOfHost(); // Handles keyboard events that were not handled by HandleKeyboardEvent(). // Platform specific implementation may override this method to handle the diff --git a/chrome/browser/extensions/extension_infobar_delegate.cc b/chrome/browser/extensions/extension_infobar_delegate.cc index c741d94e..b3b8a39 100644 --- a/chrome/browser/extensions/extension_infobar_delegate.cc +++ b/chrome/browser/extensions/extension_infobar_delegate.cc @@ -58,6 +58,15 @@ void ExtensionInfoBarDelegate::InfoBarClosed() { delete this; } +ExtensionInfoBarDelegate* +ExtensionInfoBarDelegate::AsExtensionInfoBarDelegate() { + return this; +} + +InfoBarDelegate::Type ExtensionInfoBarDelegate::GetInfoBarType() { + return PAGE_ACTION_TYPE; +} + void ExtensionInfoBarDelegate::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { diff --git a/chrome/browser/extensions/extension_infobar_delegate.h b/chrome/browser/extensions/extension_infobar_delegate.h index 54fffeb..dae7aa9 100644 --- a/chrome/browser/extensions/extension_infobar_delegate.h +++ b/chrome/browser/extensions/extension_infobar_delegate.h @@ -41,12 +41,8 @@ class ExtensionInfoBarDelegate : public InfoBarDelegate, virtual bool EqualsDelegate(InfoBarDelegate* delegate) const; virtual void InfoBarClosed(); virtual InfoBar* CreateInfoBar(); - virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() { - return this; - } - virtual Type GetInfoBarType() { - return PAGE_ACTION_TYPE; - } + virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate(); + virtual Type GetInfoBarType(); // Overridden from NotificationObserver: virtual void Observe(NotificationType type, diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 012a966..d2abbb0 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -462,6 +462,10 @@ void ExternalTabContainer::ForwardMessageToExternalHost( } } +bool ExternalTabContainer::IsExternalTabContainer() const { + return true; +} + gfx::NativeWindow ExternalTabContainer::GetFrameNativeWindow() { return hwnd(); } diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h index 597901b..1148285 100644 --- a/chrome/browser/external_tab_container_win.h +++ b/chrome/browser/external_tab_container_win.h @@ -128,9 +128,7 @@ class ExternalTabContainer : public TabContentsDelegate, virtual void ForwardMessageToExternalHost(const std::string& message, const std::string& origin, const std::string& target); - virtual bool IsExternalTabContainer() const { - return true; - }; + virtual bool IsExternalTabContainer() const; virtual gfx::NativeWindow GetFrameNativeWindow(); virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc index 71c4081..47f9b0c 100644 --- a/chrome/browser/gtk/find_bar_gtk.cc +++ b/chrome/browser/gtk/find_bar_gtk.cc @@ -311,6 +311,14 @@ void FindBarGtk::InitWidgets() { gtk_widget_show(widget()); } +FindBarController* FindBarGtk::GetFindBarController() const { + return find_bar_controller_; +} + +void FindBarGtk::SetFindBarController(FindBarController* find_bar_controller) { + find_bar_controller_ = find_bar_controller; +} + void FindBarGtk::Show(bool animate) { if (animate) { slide_widget_->Open(); diff --git a/chrome/browser/gtk/find_bar_gtk.h b/chrome/browser/gtk/find_bar_gtk.h index 5e5873e..ee9c0e5 100644 --- a/chrome/browser/gtk/find_bar_gtk.h +++ b/chrome/browser/gtk/find_bar_gtk.h @@ -41,12 +41,8 @@ class FindBarGtk : public FindBar, GtkWidget* widget() const { return slide_widget_->widget(); } // Methods from FindBar. - virtual FindBarController* GetFindBarController() const { - return find_bar_controller_; - } - virtual void SetFindBarController(FindBarController* find_bar_controller) { - find_bar_controller_ = find_bar_controller; - } + virtual FindBarController* GetFindBarController() const; + virtual void SetFindBarController(FindBarController* find_bar_controller); virtual void Show(bool animate); virtual void Hide(bool animate); virtual void SetFocusAndSelection(); diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc index 3d3cefd..8d68fa5 100644 --- a/chrome/browser/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/gtk/location_bar_view_gtk.cc @@ -661,6 +661,18 @@ void LocationBarViewGtk::Revert() { location_entry_->RevertAll(); } +const AutocompleteEditView* LocationBarViewGtk::location_entry() const { + return location_entry_.get(); +} + +AutocompleteEditView* LocationBarViewGtk::location_entry() { + return location_entry_.get(); +} + +LocationBarTesting* LocationBarViewGtk::GetLocationBarForTesting() { + return this; +} + int LocationBarViewGtk::PageActionVisibleCount() { int count = 0; gtk_container_foreach(GTK_CONTAINER(page_action_hbox_.get()), diff --git a/chrome/browser/gtk/location_bar_view_gtk.h b/chrome/browser/gtk/location_bar_view_gtk.h index 8c820d2..6ad62d1 100644 --- a/chrome/browser/gtk/location_bar_view_gtk.h +++ b/chrome/browser/gtk/location_bar_view_gtk.h @@ -113,13 +113,9 @@ class LocationBarViewGtk : public AutocompleteEditController, virtual void InvalidatePageActions(); virtual void SaveStateToContents(TabContents* contents); virtual void Revert(); - virtual const AutocompleteEditView* location_entry() const { - return location_entry_.get(); - } - virtual AutocompleteEditView* location_entry() { - return location_entry_.get(); - } - virtual LocationBarTesting* GetLocationBarForTesting() { return this; } + virtual const AutocompleteEditView* location_entry() const; + virtual AutocompleteEditView* location_entry(); + virtual LocationBarTesting* GetLocationBarForTesting(); // Implement the LocationBarTesting interface. virtual int PageActionCount() { return page_action_views_.size(); } diff --git a/chrome/browser/history/top_sites_database.cc b/chrome/browser/history/top_sites_database.cc index 96da3f9..05a588a 100644 --- a/chrome/browser/history/top_sites_database.cc +++ b/chrome/browser/history/top_sites_database.cc @@ -14,6 +14,9 @@ namespace history { TopSitesDatabaseImpl::TopSitesDatabaseImpl() { } +TopSitesDatabaseImpl::~TopSitesDatabaseImpl() { +} + bool TopSitesDatabaseImpl::Init(const FilePath& db_name) { // Settings copied from ThumbnailDatabase. db_.set_error_delegate(GetErrorHandlerForThumbnailDb()); diff --git a/chrome/browser/history/top_sites_database.h b/chrome/browser/history/top_sites_database.h index 57a110e..edfb4e5 100644 --- a/chrome/browser/history/top_sites_database.h +++ b/chrome/browser/history/top_sites_database.h @@ -66,7 +66,7 @@ class TopSitesDatabase { class TopSitesDatabaseImpl : public TopSitesDatabase { public: TopSitesDatabaseImpl(); - ~TopSitesDatabaseImpl() {} + virtual ~TopSitesDatabaseImpl(); // Must be called after creation but before any other methods are called. // Returns true on success. If false, no other functions should be called. diff --git a/chrome/browser/language_order_table_model.h b/chrome/browser/language_order_table_model.h index 0d9234d..1f27781 100644 --- a/chrome/browser/language_order_table_model.h +++ b/chrome/browser/language_order_table_model.h @@ -10,6 +10,7 @@ #include <vector> #include "app/table_model.h" +#include "base/basictypes.h" class TableModelObserver; diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index 396c533..7d602e6 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -83,6 +83,10 @@ std::string MetricsLog::GetVersionString() { return version; } +MetricsLog* MetricsLog::AsMetricsLog() { + return this; +} + void MetricsLog::RecordIncrementalStabilityElements() { DCHECK(!locked_); diff --git a/chrome/browser/metrics/metrics_log.h b/chrome/browser/metrics/metrics_log.h index 081d4b1..8f35705 100644 --- a/chrome/browser/metrics/metrics_log.h +++ b/chrome/browser/metrics/metrics_log.h @@ -55,9 +55,7 @@ class MetricsLog : public MetricsLogBase { // Get the current version of the application as a string. static std::string GetVersionString(); - virtual MetricsLog* AsMetricsLog() { - return this; - } + virtual MetricsLog* AsMetricsLog(); private: // Returns the date at which the current metrics client ID was created as diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index f14958f..11a8796 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -891,6 +891,10 @@ void ChromeURLRequestContext::OnUnloadedExtension(const std::string& id) { } } +bool ChromeURLRequestContext::IsExternal() const { + return false; +} + ChromeURLRequestContext::ChromeURLRequestContext( ChromeURLRequestContext* other) { CheckCurrentlyOnIOThread(); diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h index 97997e3..fb69ee8 100644 --- a/chrome/browser/net/chrome_url_request_context.h +++ b/chrome/browser/net/chrome_url_request_context.h @@ -151,9 +151,7 @@ class ChromeURLRequestContext : public URLRequestContext { // Returns true if this context is an external request context, like // ChromeFrame. - virtual bool IsExternal() const { - return false; - } + virtual bool IsExternal() const; protected: // Copies the dependencies from |other| into |this|. If you use this diff --git a/chrome/browser/net/connect_interceptor.cc b/chrome/browser/net/connect_interceptor.cc index 945c0ec..dc74172 100644 --- a/chrome/browser/net/connect_interceptor.cc +++ b/chrome/browser/net/connect_interceptor.cc @@ -48,4 +48,14 @@ URLRequestJob* ConnectInterceptor::MaybeIntercept(URLRequest* request) { return NULL; } +URLRequestJob* ConnectInterceptor::MaybeInterceptResponse(URLRequest* request) { + return NULL; +} + +URLRequestJob* ConnectInterceptor::MaybeInterceptRedirect( + URLRequest* request, + const GURL& location) { + return NULL; +} + } // namespace chrome_browser_net diff --git a/chrome/browser/net/connect_interceptor.h b/chrome/browser/net/connect_interceptor.h index 4900cf8..1f8eb70 100644 --- a/chrome/browser/net/connect_interceptor.h +++ b/chrome/browser/net/connect_interceptor.h @@ -24,13 +24,9 @@ class ConnectInterceptor : public URLRequest::Interceptor { // URLRequest::Interceptor overrides // Learn about referrers, and optionally preconnect based on history. virtual URLRequestJob* MaybeIntercept(URLRequest* request); - virtual URLRequestJob* MaybeInterceptResponse(URLRequest* request) { - return NULL; - } + virtual URLRequestJob* MaybeInterceptResponse(URLRequest* request); virtual URLRequestJob* MaybeInterceptRedirect(URLRequest* request, - const GURL& location) { - return NULL; - } + const GURL& location); private: DISALLOW_COPY_AND_ASSIGN(ConnectInterceptor); diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc index d1041cb..9933f8f 100644 --- a/chrome/browser/password_manager/password_manager.cc +++ b/chrome/browser/password_manager/password_manager.cc @@ -122,6 +122,10 @@ void PasswordManager::ClearProvisionalSave() { provisional_save_manager_.reset(); } +void PasswordManager::SetObserver(LoginModelObserver* observer) { + observer_ = observer; +} + void PasswordManager::DidStopLoading() { if (!provisional_save_manager_.get()) return; diff --git a/chrome/browser/password_manager/password_manager.h b/chrome/browser/password_manager/password_manager.h index f5ec7e3..017f5aa 100644 --- a/chrome/browser/password_manager/password_manager.h +++ b/chrome/browser/password_manager/password_manager.h @@ -62,9 +62,7 @@ class PasswordManager : public LoginModel { void ClearProvisionalSave(); // LoginModel implementation. - virtual void SetObserver(LoginModelObserver* observer) { - observer_ = observer; - } + virtual void SetObserver(LoginModelObserver* observer); private: // Note about how a PasswordFormManager can transition from diff --git a/chrome/browser/possible_url_model.cc b/chrome/browser/possible_url_model.cc index bbb40b8..f419762 100644 --- a/chrome/browser/possible_url_model.cc +++ b/chrome/browser/possible_url_model.cc @@ -206,3 +206,7 @@ void PossibleURLModel::OnFavIconAvailable( } } } + +void PossibleURLModel::SetObserver(TableModelObserver* observer) { + observer_ = observer; +} diff --git a/chrome/browser/possible_url_model.h b/chrome/browser/possible_url_model.h index e586af0..0c0b531 100644 --- a/chrome/browser/possible_url_model.h +++ b/chrome/browser/possible_url_model.h @@ -50,9 +50,7 @@ class PossibleURLModel : public TableModel { bool expired, GURL icon_url); - virtual void SetObserver(TableModelObserver* observer) { - observer_ = observer; - } + virtual void SetObserver(TableModelObserver* observer); private: // The current profile. diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.cc b/chrome/browser/safe_browsing/safe_browsing_store_file.cc index 032aa6e..4e4136c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_file.cc @@ -220,6 +220,35 @@ void SafeBrowsingStoreFile::Init(const FilePath& filename, corruption_callback_.reset(corruption_callback); } +bool SafeBrowsingStoreFile::BeginChunk() { + return ClearChunkBuffers(); +} + +bool SafeBrowsingStoreFile::WriteAddPrefix(int32 chunk_id, SBPrefix prefix) { + add_prefixes_.push_back(SBAddPrefix(chunk_id, prefix)); + return true; +} + +bool SafeBrowsingStoreFile::WriteAddHash(int32 chunk_id, + base::Time receive_time, + SBFullHash full_hash) { + add_hashes_.push_back(SBAddFullHash(chunk_id, receive_time, full_hash)); + return true; +} + +bool SafeBrowsingStoreFile::WriteSubPrefix(int32 chunk_id, + int32 add_chunk_id, + SBPrefix prefix) { + sub_prefixes_.push_back(SBSubPrefix(chunk_id, add_chunk_id, prefix)); + return true; +} + +bool SafeBrowsingStoreFile::WriteSubHash(int32 chunk_id, int32 add_chunk_id, + SBFullHash full_hash) { + sub_hashes_.push_back(SBSubFullHash(chunk_id, add_chunk_id, full_hash)); + return true; +} + bool SafeBrowsingStoreFile::OnCorruptDatabase() { if (corruption_callback_.get()) corruption_callback_->Run(); @@ -587,3 +616,37 @@ bool SafeBrowsingStoreFile::CancelUpdate() { old_store_.reset(); return Close(); } + +void SafeBrowsingStoreFile::SetAddChunk(int32 chunk_id) { + add_chunks_cache_.insert(chunk_id); +} + +bool SafeBrowsingStoreFile::CheckAddChunk(int32 chunk_id) { + return add_chunks_cache_.count(chunk_id) > 0; +} + +void SafeBrowsingStoreFile::GetAddChunks(std::vector<int32>* out) { + out->clear(); + out->insert(out->end(), add_chunks_cache_.begin(), add_chunks_cache_.end()); +} + +void SafeBrowsingStoreFile::SetSubChunk(int32 chunk_id) { + sub_chunks_cache_.insert(chunk_id); +} + +bool SafeBrowsingStoreFile::CheckSubChunk(int32 chunk_id) { + return sub_chunks_cache_.count(chunk_id) > 0; +} + +void SafeBrowsingStoreFile::GetSubChunks(std::vector<int32>* out) { + out->clear(); + out->insert(out->end(), sub_chunks_cache_.begin(), sub_chunks_cache_.end()); +} + +void SafeBrowsingStoreFile::DeleteAddChunk(int32 chunk_id) { + add_del_cache_.insert(chunk_id); +} + +void SafeBrowsingStoreFile::DeleteSubChunk(int32 chunk_id) { + sub_del_cache_.insert(chunk_id); +} diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.h b/chrome/browser/safe_browsing/safe_browsing_store_file.h index 7cdc17e..3530e60 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file.h +++ b/chrome/browser/safe_browsing/safe_browsing_store_file.h @@ -124,28 +124,14 @@ class SafeBrowsingStoreFile : public SafeBrowsingStore { // Delete any on-disk files, including the permanent storage. virtual bool Delete(); - virtual bool BeginChunk() { - return ClearChunkBuffers(); - } - virtual bool WriteAddPrefix(int32 chunk_id, SBPrefix prefix) { - add_prefixes_.push_back(SBAddPrefix(chunk_id, prefix)); - return true; - } + virtual bool BeginChunk(); + virtual bool WriteAddPrefix(int32 chunk_id, SBPrefix prefix); virtual bool WriteAddHash(int32 chunk_id, - base::Time receive_time, SBFullHash full_hash) { - add_hashes_.push_back(SBAddFullHash(chunk_id, receive_time, full_hash)); - return true; - } + base::Time receive_time, SBFullHash full_hash); virtual bool WriteSubPrefix(int32 chunk_id, - int32 add_chunk_id, SBPrefix prefix) { - sub_prefixes_.push_back(SBSubPrefix(chunk_id, add_chunk_id, prefix)); - return true; - } + int32 add_chunk_id, SBPrefix prefix); virtual bool WriteSubHash(int32 chunk_id, int32 add_chunk_id, - SBFullHash full_hash) { - sub_hashes_.push_back(SBSubFullHash(chunk_id, add_chunk_id, full_hash)); - return true; - } + SBFullHash full_hash); virtual bool FinishChunk(); virtual bool BeginUpdate(); @@ -157,33 +143,15 @@ class SafeBrowsingStoreFile : public SafeBrowsingStore { std::vector<SBAddFullHash>* add_full_hashes_result); virtual bool CancelUpdate(); - virtual void SetAddChunk(int32 chunk_id) { - add_chunks_cache_.insert(chunk_id); - } - virtual bool CheckAddChunk(int32 chunk_id) { - return add_chunks_cache_.count(chunk_id) > 0; - } - virtual void GetAddChunks(std::vector<int32>* out) { - out->clear(); - out->insert(out->end(), add_chunks_cache_.begin(), add_chunks_cache_.end()); - } - virtual void SetSubChunk(int32 chunk_id) { - sub_chunks_cache_.insert(chunk_id); - } - virtual bool CheckSubChunk(int32 chunk_id) { - return sub_chunks_cache_.count(chunk_id) > 0; - } - virtual void GetSubChunks(std::vector<int32>* out) { - out->clear(); - out->insert(out->end(), sub_chunks_cache_.begin(), sub_chunks_cache_.end()); - } + virtual void SetAddChunk(int32 chunk_id); + virtual bool CheckAddChunk(int32 chunk_id); + virtual void GetAddChunks(std::vector<int32>* out); + virtual void SetSubChunk(int32 chunk_id); + virtual bool CheckSubChunk(int32 chunk_id); + virtual void GetSubChunks(std::vector<int32>* out); - virtual void DeleteAddChunk(int32 chunk_id) { - add_del_cache_.insert(chunk_id); - } - virtual void DeleteSubChunk(int32 chunk_id) { - sub_del_cache_.insert(chunk_id); - } + virtual void DeleteAddChunk(int32 chunk_id); + virtual void DeleteSubChunk(int32 chunk_id); // Returns the name of the temporary file used to buffer data for // |filename|. Exported for unit tests. diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc index 957e764..a9af82d 100644 --- a/chrome/browser/tab_contents/interstitial_page.cc +++ b/chrome/browser/tab_contents/interstitial_page.cc @@ -398,6 +398,10 @@ void InterstitialPage::DomOperationResponse(const std::string& json_string, CommandReceived(json_string); } +RendererPreferences InterstitialPage::GetRendererPrefs(Profile* profile) const { + return renderer_preferences_; +} + RenderViewHost* InterstitialPage::CreateRenderViewHost() { RenderViewHost* render_view_host = new RenderViewHost( SiteInstance::CreateSiteInstance(tab()->profile()), diff --git a/chrome/browser/tab_contents/interstitial_page.h b/chrome/browser/tab_contents/interstitial_page.h index 1087761..097fbde 100644 --- a/chrome/browser/tab_contents/interstitial_page.h +++ b/chrome/browser/tab_contents/interstitial_page.h @@ -128,9 +128,7 @@ class InterstitialPage : public NotificationObserver, const std::wstring& title); virtual void DomOperationResponse(const std::string& json_string, int automation_id); - virtual RendererPreferences GetRendererPrefs(Profile* profile) const { - return renderer_preferences_; - } + virtual RendererPreferences GetRendererPrefs(Profile* profile) const; // Invoked when the page sent a command through DOMAutomation. virtual void CommandReceived(const std::string& command) {} diff --git a/chrome/renderer/external_host_bindings.cc b/chrome/renderer/external_host_bindings.cc index 51a71bc..c17c167 100644 --- a/chrome/renderer/external_host_bindings.cc +++ b/chrome/renderer/external_host_bindings.cc @@ -16,6 +16,9 @@ ExternalHostBindings::ExternalHostBindings() : frame_(NULL) { BindProperty("onmessage", &on_message_handler_); } +ExternalHostBindings::~ExternalHostBindings() { +} + void ExternalHostBindings::postMessage( const CppArgumentList& args, CppVariant* result) { DCHECK(result); diff --git a/chrome/renderer/external_host_bindings.h b/chrome/renderer/external_host_bindings.h index 49fdc9d..66ddf6c7 100644 --- a/chrome/renderer/external_host_bindings.h +++ b/chrome/renderer/external_host_bindings.h @@ -17,8 +17,7 @@ class ExternalHostBindings : public DOMBoundBrowserObject { public: ExternalHostBindings(); - virtual ~ExternalHostBindings() { - } + virtual ~ExternalHostBindings(); // The postMessage() function provided to Javascript. void postMessage(const CppArgumentList& args, CppVariant* result); diff --git a/chrome/renderer/media/audio_renderer_impl.h b/chrome/renderer/media/audio_renderer_impl.h index f8fa094..a0e3a2a 100644 --- a/chrome/renderer/media/audio_renderer_impl.h +++ b/chrome/renderer/media/audio_renderer_impl.h @@ -39,6 +39,7 @@ #pragma once #include "base/gtest_prod_util.h" +#include "base/message_loop.h" #include "base/scoped_ptr.h" #include "base/lock.h" #include "base/shared_memory.h" diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index ddf1ec8..903a71d 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc @@ -36,6 +36,28 @@ class SendTask : public Task { //------------------------------------------------------------------------------ +ChannelProxy::MessageFilter::~MessageFilter() {} + +void ChannelProxy::MessageFilter::OnFilterAdded(Channel* channel) {} + +void ChannelProxy::MessageFilter::OnFilterRemoved() {} + +void ChannelProxy::MessageFilter::OnChannelConnected(int32 peer_pid) {} + +void ChannelProxy::MessageFilter::OnChannelError() {} + +void ChannelProxy::MessageFilter::OnChannelClosing() {} + +bool ChannelProxy::MessageFilter::OnMessageReceived(const Message& message) { + return false; +} + +void ChannelProxy::MessageFilter::OnDestruct() { + delete this; +} + +//------------------------------------------------------------------------------ + ChannelProxy::Context::Context(Channel::Listener* listener, MessageFilter* filter, MessageLoop* ipc_message_loop) @@ -248,6 +270,10 @@ ChannelProxy::ChannelProxy(const std::string& channel_id, Channel::Mode mode, Init(channel_id, mode, ipc_thread, create_pipe_now); } +ChannelProxy::~ChannelProxy() { + Close(); +} + void ChannelProxy::Init(const std::string& channel_id, Channel::Mode mode, MessageLoop* ipc_thread_loop, bool create_pipe_now) { if (create_pipe_now) { diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h index bfebcb8..19aea28 100644 --- a/ipc/ipc_channel_proxy.h +++ b/ipc/ipc_channel_proxy.h @@ -55,42 +55,38 @@ class ChannelProxy : public Message::Sender { class MessageFilter : public base::RefCountedThreadSafe<MessageFilter, MessageFilterTraits> { public: - virtual ~MessageFilter() {} + virtual ~MessageFilter(); // Called on the background thread to provide the filter with access to the // channel. Called when the IPC channel is initialized or when AddFilter // is called if the channel is already initialized. - virtual void OnFilterAdded(Channel* channel) {} + virtual void OnFilterAdded(Channel* channel); // Called on the background thread when the filter has been removed from // the ChannelProxy and when the Channel is closing. After a filter is // removed, it will not be called again. - virtual void OnFilterRemoved() {} + virtual void OnFilterRemoved(); // Called to inform the filter that the IPC channel is connected and we // have received the internal Hello message from the peer. - virtual void OnChannelConnected(int32 peer_pid) {} + virtual void OnChannelConnected(int32 peer_pid); // Called when there is an error on the channel, typically that the channel // has been closed. - virtual void OnChannelError() {} + virtual void OnChannelError(); // Called to inform the filter that the IPC channel will be destroyed. // OnFilterRemoved is called immediately after this. - virtual void OnChannelClosing() {} + virtual void OnChannelClosing(); // Return true to indicate that the message was handled, or false to let // the message be handled in the default way. - virtual bool OnMessageReceived(const Message& message) { - return false; - } + virtual bool OnMessageReceived(const Message& message); // Called when the message filter is about to be deleted. This gives // derived classes the option of controlling which thread they're deleted // on etc. - virtual void OnDestruct() { - delete this; - } + virtual void OnDestruct(); }; struct MessageFilterTraits { @@ -111,9 +107,7 @@ class ChannelProxy : public Message::Sender { Channel::Listener* listener, MessageFilter* filter, MessageLoop* ipc_thread_loop); - virtual ~ChannelProxy() { - Close(); - } + virtual ~ChannelProxy(); // Close the IPC::Channel. This operation completes asynchronously, once the // background thread processes the command to close the channel. It is ok to diff --git a/media/base/factory.h b/media/base/factory.h index 49bd868..b9e637d 100644 --- a/media/base/factory.h +++ b/media/base/factory.h @@ -32,6 +32,7 @@ #include <vector> +#include "base/logging.h" #include "base/ref_counted.h" #include "media/base/filters.h" diff --git a/media/base/filters.cc b/media/base/filters.cc new file mode 100644 index 0000000..0a428b9 --- /dev/null +++ b/media/base/filters.cc @@ -0,0 +1,80 @@ +// 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 "media/base/filters.h" + +#include "base/logging.h" +#include "base/message_loop.h" + +namespace media { + +MediaFilter::MediaFilter() : host_(NULL), message_loop_(NULL) {} + +void MediaFilter::set_host(FilterHost* host) { + DCHECK(host); + DCHECK(!host_); + host_ = host; +} + +FilterHost* MediaFilter::host() { + return host_; +} + +void MediaFilter::set_message_loop(MessageLoop* message_loop) { + DCHECK(message_loop); + DCHECK(!message_loop_); + message_loop_ = message_loop; +} + +MessageLoop* MediaFilter::message_loop() { + return message_loop_; +} + +void MediaFilter::Play(FilterCallback* callback) { + DCHECK(callback); + if (callback) { + callback->Run(); + delete callback; + } +} + +void MediaFilter::Pause(FilterCallback* callback) { + DCHECK(callback); + if (callback) { + callback->Run(); + delete callback; + } +} + +void MediaFilter::Flush(FilterCallback* callback) { + DCHECK(callback); + if (callback) { + callback->Run(); + delete callback; + } +} + +void MediaFilter::Stop(FilterCallback* callback) { + DCHECK(callback); + if (callback) { + callback->Run(); + delete callback; + } +} + +void MediaFilter::SetPlaybackRate(float playback_rate) {} + +void MediaFilter::Seek(base::TimeDelta time, FilterCallback* callback) { + scoped_ptr<FilterCallback> seek_callback(callback); + if (seek_callback.get()) { + seek_callback->Run(); + } +} + +void MediaFilter::OnAudioRendererDisabled() { +} + +MediaFilter::~MediaFilter() {} + +} // namespace media diff --git a/media/base/filters.h b/media/base/filters.h index 0fdf6cf..30e86a6 100644 --- a/media/base/filters.h +++ b/media/base/filters.h @@ -27,14 +27,14 @@ #include <string> #include "base/callback.h" -#include "base/logging.h" -#include "base/message_loop.h" #include "base/ref_counted.h" #include "base/time.h" #include "base/scoped_ptr.h" #include "media/base/media_format.h" #include "media/base/video_frame.h" +class MessageLoop; + namespace media { class Buffer; @@ -60,103 +60,61 @@ typedef Callback0::Type FilterCallback; class MediaFilter : public base::RefCountedThreadSafe<MediaFilter> { public: - MediaFilter() : host_(NULL), message_loop_(NULL) {} + MediaFilter(); // Sets the private member |host_|. This is the first method called by // the FilterHost after a filter is created. The host holds a strong // reference to the filter. The reference held by the host is guaranteed // to be released before the host object is destroyed by the pipeline. - virtual void set_host(FilterHost* host) { - DCHECK(host); - DCHECK(!host_); - host_ = host; - } + virtual void set_host(FilterHost* host); - virtual FilterHost* host() { - return host_; - } + virtual FilterHost* host(); // Sets the private member |message_loop_|, which is used by filters for // processing asynchronous tasks and maintaining synchronized access to // internal data members. The message loop should be running and exceed the // lifetime of the filter. - virtual void set_message_loop(MessageLoop* message_loop) { - DCHECK(message_loop); - DCHECK(!message_loop_); - message_loop_ = message_loop; - } + virtual void set_message_loop(MessageLoop* message_loop); - virtual MessageLoop* message_loop() { - return message_loop_; - } + virtual MessageLoop* message_loop(); // The pipeline has resumed playback. Filters can continue requesting reads. // Filters may implement this method if they need to respond to this call. // TODO(boliu): Check that callback is not NULL in subclasses. - virtual void Play(FilterCallback* callback) { - DCHECK(callback); - if (callback) { - callback->Run(); - delete callback; - } - } + virtual void Play(FilterCallback* callback); // The pipeline has paused playback. Filters should stop buffer exchange. // Filters may implement this method if they need to respond to this call. // TODO(boliu): Check that callback is not NULL in subclasses. - virtual void Pause(FilterCallback* callback) { - DCHECK(callback); - if (callback) { - callback->Run(); - delete callback; - } - } + virtual void Pause(FilterCallback* callback); // The pipeline has been flushed. Filters should return buffer to owners. // Filters may implement this method if they need to respond to this call. // TODO(boliu): Check that callback is not NULL in subclasses. - virtual void Flush(FilterCallback* callback) { - DCHECK(callback); - if (callback) { - callback->Run(); - delete callback; - } - } + virtual void Flush(FilterCallback* callback); // The pipeline is being stopped either as a result of an error or because // the client called Stop(). // TODO(boliu): Check that callback is not NULL in subclasses. - virtual void Stop(FilterCallback* callback) { - DCHECK(callback); - if (callback) { - callback->Run(); - delete callback; - } - } + virtual void Stop(FilterCallback* callback); // The pipeline playback rate has been changed. Filters may implement this // method if they need to respond to this call. - virtual void SetPlaybackRate(float playback_rate) {} + virtual void SetPlaybackRate(float playback_rate); // Carry out any actions required to seek to the given time, executing the // callback upon completion. - virtual void Seek(base::TimeDelta time, FilterCallback* callback) { - scoped_ptr<FilterCallback> seek_callback(callback); - if (seek_callback.get()) { - seek_callback->Run(); - } - } + virtual void Seek(base::TimeDelta time, FilterCallback* callback); // This method is called from the pipeline when the audio renderer // is disabled. Filters can ignore the notification if they do not // need to react to this event. - virtual void OnAudioRendererDisabled() { - } + virtual void OnAudioRendererDisabled(); protected: // Only allow scoped_refptr<> to delete filters. friend class base::RefCountedThreadSafe<MediaFilter>; - virtual ~MediaFilter() {} + virtual ~MediaFilter(); FilterHost* host() const { return host_; } MessageLoop* message_loop() const { return message_loop_; } diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc index c871343..1752a4d 100644 --- a/media/filters/ffmpeg_demuxer.cc +++ b/media/filters/ffmpeg_demuxer.cc @@ -4,6 +4,7 @@ #include "base/callback.h" #include "base/command_line.h" +#include "base/message_loop.h" #include "base/scoped_ptr.h" #include "base/stl_util-inl.h" #include "base/string_util.h" diff --git a/media/media.gyp b/media/media.gyp index 21f0dc1..5685729 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -75,6 +75,7 @@ 'base/djb2.h', 'base/factory.h', 'base/filter_host.h', + 'base/filters.cc', 'base/filters.h', 'base/media.h', 'base/media_format.cc', diff --git a/media/tools/player_x11/x11_video_renderer.cc b/media/tools/player_x11/x11_video_renderer.cc index 707a578..6819468 100644 --- a/media/tools/player_x11/x11_video_renderer.cc +++ b/media/tools/player_x11/x11_video_renderer.cc @@ -9,6 +9,7 @@ #include <X11/extensions/Xrender.h> #include <X11/extensions/Xcomposite.h> +#include "base/message_loop.h" #include "media/base/video_frame.h" #include "media/base/yuv_convert.h" diff --git a/views/controls/table/native_table_gtk.cc b/views/controls/table/native_table_gtk.cc index e8f631f..75f724b 100644 --- a/views/controls/table/native_table_gtk.cc +++ b/views/controls/table/native_table_gtk.cc @@ -1,11 +1,12 @@ -// 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. +// 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 "views/controls/table/native_table_gtk.h" #include <string> +#include "base/logging.h" #include "base/utf_string_conversions.h" #include "gfx/gtk_util.h" #include "third_party/skia/include/core/SkBitmap.h" diff --git a/views/controls/table/table_view2.cc b/views/controls/table/table_view2.cc index c76162f..0f33b94 100644 --- a/views/controls/table/table_view2.cc +++ b/views/controls/table/table_view2.cc @@ -6,6 +6,7 @@ #include "views/controls/table/table_view2.h" #include "app/table_model.h" +#include "base/logging.h" #include "views/controls/native/native_view_host.h" #include "views/controls/table/table_view_observer.h" diff --git a/webkit/glue/media/buffered_data_source_unittest.cc b/webkit/glue/media/buffered_data_source_unittest.cc index 9db1041..636819c 100644 --- a/webkit/glue/media/buffered_data_source_unittest.cc +++ b/webkit/glue/media/buffered_data_source_unittest.cc @@ -6,6 +6,7 @@ #include "base/callback.h" #include "base/format_macros.h" +#include "base/message_loop.h" #include "base/string_util.h" #include "media/base/filters.h" #include "media/base/mock_filter_host.h" |