diff options
-rw-r--r-- | app/resource_bundle.cc | 12 | ||||
-rw-r--r-- | app/resource_bundle.h | 4 | ||||
-rw-r--r-- | app/resource_bundle_dummy.cc | 4 | ||||
-rw-r--r-- | app/resource_bundle_linux.cc | 7 | ||||
-rw-r--r-- | app/resource_bundle_posix.cc | 1 | ||||
-rw-r--r-- | app/resource_bundle_win.cc | 1 | ||||
-rw-r--r-- | base/histogram.cc | 1 | ||||
-rw-r--r-- | base/histogram.h | 5 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_histograms.h | 1 | ||||
-rw-r--r-- | chrome_frame/metrics_service.h | 1 |
10 files changed, 24 insertions, 13 deletions
diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc index d61e83d..c125907 100644 --- a/app/resource_bundle.cc +++ b/app/resource_bundle.cc @@ -5,6 +5,7 @@ #include "app/resource_bundle.h" #include "base/data_pack.h" +#include "base/lock.h" #include "base/logging.h" #include "base/string_piece.h" #include "build/build_config.h" @@ -75,7 +76,8 @@ ResourceBundle& ResourceBundle::GetSharedInstance() { } ResourceBundle::ResourceBundle() - : resources_data_(NULL), + : lock_(new Lock), + resources_data_(NULL), locale_resources_data_(NULL) { } @@ -121,7 +123,7 @@ RefCountedStaticMemory* ResourceBundle::LoadDataResourceBytes( SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { // Check to see if we already have the Skia image in the cache. { - AutoLock lock_scope(lock_); + AutoLock lock_scope(*lock_); SkImageMap::const_iterator found = skia_images_.find(resource_id); if (found != skia_images_.end()) return found->second; @@ -133,7 +135,7 @@ SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { if (bitmap.get()) { // We loaded successfully. Cache the Skia version of the bitmap. - AutoLock lock_scope(lock_); + AutoLock lock_scope(*lock_); // Another thread raced us, and has already cached the skia image. if (skia_images_.count(resource_id)) @@ -148,7 +150,7 @@ SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { LOG(WARNING) << "Unable to load bitmap with id " << resource_id; NOTREACHED(); // Want to assert in debug mode. - AutoLock lock_scope(lock_); // Guard empty_bitmap initialization. + AutoLock lock_scope(*lock_); // Guard empty_bitmap initialization. static SkBitmap* empty_bitmap = NULL; if (!empty_bitmap) { @@ -164,7 +166,7 @@ SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { } void ResourceBundle::LoadFontsIfNecessary() { - AutoLock lock_scope(lock_); + AutoLock lock_scope(*lock_); if (!base_font_.get()) { base_font_.reset(new gfx::Font()); diff --git a/app/resource_bundle.h b/app/resource_bundle.h index e2ec86c..a8c1cf7 100644 --- a/app/resource_bundle.h +++ b/app/resource_bundle.h @@ -17,7 +17,6 @@ #include "base/basictypes.h" #include "base/file_path.h" -#include "base/lock.h" #include "base/ref_counted_memory.h" #include "base/scoped_ptr.h" #include "base/string16.h" @@ -31,6 +30,7 @@ typedef struct _GdkPixbuf GdkPixbuf; namespace gfx { class Font; } +class Lock; class SkBitmap; typedef uint32 SkColor; namespace base { @@ -232,7 +232,7 @@ class ResourceBundle { // Class level lock. Used to protect internal data structures that may be // accessed from other threads (e.g., skia_images_). - Lock lock_; + scoped_ptr<Lock> lock_; // Handles for data sources. DataHandle resources_data_; diff --git a/app/resource_bundle_dummy.cc b/app/resource_bundle_dummy.cc index 6baa1a8..f5db317 100644 --- a/app/resource_bundle_dummy.cc +++ b/app/resource_bundle_dummy.cc @@ -6,6 +6,7 @@ #include <windows.h> +#include "base/lock.h" #include "base/logging.h" #include "base/win_util.h" #include "gfx/font.h" @@ -46,7 +47,8 @@ ResourceBundle& ResourceBundle::GetSharedInstance() { } ResourceBundle::ResourceBundle() - : resources_data_(NULL), + : lock_(new Lock), + resources_data_(NULL), locale_resources_data_(NULL) { } diff --git a/app/resource_bundle_linux.cc b/app/resource_bundle_linux.cc index 7ebe4e6..a137a92 100644 --- a/app/resource_bundle_linux.cc +++ b/app/resource_bundle_linux.cc @@ -13,6 +13,7 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/i18n/rtl.h" +#include "base/lock.h" #include "base/logging.h" #include "base/path_service.h" #include "base/string_piece.h" @@ -91,7 +92,7 @@ GdkPixbuf* ResourceBundle::GetPixbufImpl(int resource_id, bool rtl_enabled) { // Check to see if we already have the pixbuf in the cache. { - AutoLock lock_scope(lock_); + AutoLock lock_scope(*lock_); GdkPixbufMap::const_iterator found = gdk_pixbufs_.find(key); if (found != gdk_pixbufs_.end()) return found->second; @@ -103,7 +104,7 @@ GdkPixbuf* ResourceBundle::GetPixbufImpl(int resource_id, bool rtl_enabled) { // We loaded successfully. Cache the pixbuf. if (pixbuf) { - AutoLock lock_scope(lock_); + AutoLock lock_scope(*lock_); // Another thread raced us, and has already cached the pixbuf. if (gdk_pixbufs_.count(key)) { @@ -120,7 +121,7 @@ GdkPixbuf* ResourceBundle::GetPixbufImpl(int resource_id, bool rtl_enabled) { LOG(WARNING) << "Unable to load GdkPixbuf with id " << resource_id; NOTREACHED(); // Want to assert in debug mode. - AutoLock lock_scope(lock_); // Guard empty_bitmap initialization. + AutoLock lock_scope(*lock_); // Guard empty_bitmap initialization. static GdkPixbuf* empty_bitmap = NULL; if (!empty_bitmap) { diff --git a/app/resource_bundle_posix.cc b/app/resource_bundle_posix.cc index cdd9ee2..1ee5fd1 100644 --- a/app/resource_bundle_posix.cc +++ b/app/resource_bundle_posix.cc @@ -6,6 +6,7 @@ #include "app/l10n_util.h" #include "base/data_pack.h" +#include "base/lock.h" #include "base/logging.h" #include "base/stl_util-inl.h" #include "base/string16.h" diff --git a/app/resource_bundle_win.cc b/app/resource_bundle_win.cc index 498cec6..f143193 100644 --- a/app/resource_bundle_win.cc +++ b/app/resource_bundle_win.cc @@ -11,6 +11,7 @@ #include "base/data_pack.h" #include "base/debug_util.h" #include "base/file_util.h" +#include "base/lock.h" #include "base/logging.h" #include "base/path_service.h" #include "base/resource_util.h" diff --git a/base/histogram.cc b/base/histogram.cc index a4912b9..4b76160 100644 --- a/base/histogram.cc +++ b/base/histogram.cc @@ -12,6 +12,7 @@ #include <math.h> #include <string> +#include "base/lock.h" #include "base/logging.h" #include "base/pickle.h" #include "base/string_util.h" diff --git a/base/histogram.h b/base/histogram.h index 64ae9cb..ac97a67 100644 --- a/base/histogram.h +++ b/base/histogram.h @@ -35,11 +35,12 @@ #include <string> #include <vector> -#include "base/lock.h" #include "base/ref_counted.h" #include "base/logging.h" #include "base/time.h" +class Lock; + //------------------------------------------------------------------------------ // Provide easy general purpose histogram in a macro, just like stats counters. // The first four macros use 50 buckets. @@ -361,7 +362,7 @@ class Histogram : public base::RefCountedThreadSafe<Histogram> { // Accessors for factory constuction, serialization and testing. //---------------------------------------------------------------------------- virtual ClassType histogram_type() const { return HISTOGRAM; } - const std::string histogram_name() const { return histogram_name_; } + const std::string& histogram_name() const { return histogram_name_; } Sample declared_min() const { return declared_min_; } Sample declared_max() const { return declared_max_; } virtual Sample ranges(size_t i) const { return ranges_[i];} diff --git a/chrome_frame/chrome_frame_histograms.h b/chrome_frame/chrome_frame_histograms.h index 0e7e600..0afcc69 100644 --- a/chrome_frame/chrome_frame_histograms.h +++ b/chrome_frame/chrome_frame_histograms.h @@ -10,6 +10,7 @@ #include <vector> #include "base/basictypes.h" +#include "base/lock.h" #include "base/histogram.h" #include "base/process.h" #include "base/scoped_ptr.h" diff --git a/chrome_frame/metrics_service.h b/chrome_frame/metrics_service.h index af97b1c..dd71483 100644 --- a/chrome_frame/metrics_service.h +++ b/chrome_frame/metrics_service.h @@ -14,6 +14,7 @@ #include "base/basictypes.h" #include "base/histogram.h" #include "base/lazy_instance.h" +#include "base/platform_thread.h" #include "base/scoped_ptr.h" #include "base/thread_local.h" #include "chrome/common/metrics_helpers.h" |