summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-27 17:45:44 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-27 17:45:44 +0000
commit974558f07cd465431b85f53ef01cb17f6fe83fda (patch)
tree3972493be3326d5e1d6462c666031d2942cc196e
parent316726d913eb5e48426bd8dd6cb9c7f942556423 (diff)
downloadchromium_src-974558f07cd465431b85f53ef01cb17f6fe83fda.zip
chromium_src-974558f07cd465431b85f53ef01cb17f6fe83fda.tar.gz
chromium_src-974558f07cd465431b85f53ef01cb17f6fe83fda.tar.bz2
More debugging statements to try to track down BrowserThemePack crash.
BUG=31719 TEST=none Review URL: http://codereview.chromium.org/552174 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37259 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser_theme_pack.cc47
-rw-r--r--chrome/browser/browser_theme_provider.cc26
2 files changed, 68 insertions, 5 deletions
diff --git a/chrome/browser/browser_theme_pack.cc b/chrome/browser/browser_theme_pack.cc
index b6e3fd9..6ee8dcc 100644
--- a/chrome/browser/browser_theme_pack.cc
+++ b/chrome/browser/browser_theme_pack.cc
@@ -26,6 +26,12 @@
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkUnPreMultiply.h"
+// No optimizations under windows until we know what's up with the crashing.
+#if defined(OS_WIN)
+#pragma optimize("", off)
+#pragma warning(disable:4748)
+#endif
+
namespace {
// Version number of the current theme pack. We just throw out and rebuild
@@ -211,8 +217,8 @@ BrowserThemePack::~BrowserThemePack() {
// static
BrowserThemePack* BrowserThemePack::BuildFromExtension(Extension* extension) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
- DCHECK(extension);
- DCHECK(extension->IsTheme());
+ CHECK(extension);
+ CHECK(extension->IsTheme());
BrowserThemePack* pack = new BrowserThemePack;
pack->BuildHeader(extension);
@@ -291,6 +297,18 @@ scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromDataPack(
}
bool BrowserThemePack::WriteToDisk(FilePath path) const {
+ FilePath::CharType full_path_on_stack[512 + 1];
+ int image_memory_size = image_memory_.size();
+ int prepared_images_size = prepared_images_.size();
+
+ // Copy path's backing string onto the stack because that's what get's stored
+ // in minidumps. :(
+ size_t i = 0;
+ for (i = 0; i < 512 && i < path.value().size(); ++i) {
+ full_path_on_stack[i] = path.value()[i];
+ }
+ full_path_on_stack[i] = '\0';
+
// Add resources for each of the property arrays.
RawDataForWriting resources;
resources[kHeaderID] = base::StringPiece(
@@ -310,6 +328,11 @@ bool BrowserThemePack::WriteToDisk(FilePath path) const {
RepackImages(prepared_images_, &reencoded_images);
AddRawImagesTo(reencoded_images, &resources);
+ // Force the values to stick around since the crash happens in
+ // reencoded_images.
+ LOG(INFO) << full_path_on_stack << " / " << image_memory_size
+ << prepared_images_size;
+
return base::DataPack::WritePack(path, resources);
}
@@ -825,14 +848,16 @@ void BrowserThemePack::RepackImages(const ImageCache& images,
NOTREACHED() << "Image file for resource " << it->first
<< " could not be encoded.";
} else {
- (*reencoded_images)[it->first] = RefCountedBytes::TakeVector(&image_data);
+ RefCountedBytes* bytes = RefCountedBytes::TakeVector(&image_data);
+ CHECK(bytes);
+ (*reencoded_images)[it->first] = bytes;
}
}
}
void BrowserThemePack::MergeImageCaches(
const ImageCache& source, ImageCache* destination) const {
-
+ CHECK(destination);
for (ImageCache::const_iterator it = source.begin(); it != source.end();
++it) {
ImageCache::const_iterator bitmap_it = destination->find(it->first);
@@ -845,8 +870,16 @@ void BrowserThemePack::MergeImageCaches(
void BrowserThemePack::AddRawImagesTo(const RawImages& images,
RawDataForWriting* out) const {
+ int resource_at_time_of_crash = -1;
+
+ CHECK(out);
for (RawImages::const_iterator it = images.begin(); it != images.end();
++it) {
+ resource_at_time_of_crash = it->first;
+
+ CHECK(it->second->front());
+ CHECK(it->second->size());
+
(*out)[it->first] = base::StringPiece(
reinterpret_cast<const char*>(it->second->front()), it->second->size());
}
@@ -867,3 +900,9 @@ color_utils::HSL BrowserThemePack::GetTintInternal(int id) const {
return BrowserThemeProvider::GetDefaultTint(id);
}
+
+// No optimizations under windows until we know what's up with the crashing.
+#if defined(OS_WIN)
+#pragma warning(default:4748)
+#pragma optimize("", on)
+#endif
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc
index 20f5826..45dff50 100644
--- a/chrome/browser/browser_theme_provider.cc
+++ b/chrome/browser/browser_theme_provider.cc
@@ -38,6 +38,12 @@
#include "app/win_util.h"
#endif
+// No optimizations under windows until we know what's up with the crashing.
+#if defined(OS_WIN)
+#pragma optimize("", off)
+#pragma warning(disable:4748)
+#endif
+
// Strings used in alignment properties.
const char* BrowserThemeProvider::kAlignmentTop = "top";
const char* BrowserThemeProvider::kAlignmentBottom = "bottom";
@@ -558,17 +564,29 @@ void BrowserThemeProvider::SaveThemeID(const std::string& id) {
void BrowserThemeProvider::MigrateTheme(Extension* extension,
const std::string& name) {
+ FilePath::CharType full_name_on_stack[512 + 1];
+
+ // Copy names's backing string onto the stack because that's what get's
+ // stored in minidumps. :(
+ size_t i = 0;
+ for (i = 0; i < 512 && i < name.size(); ++i) {
+ full_name_on_stack[i] = name[i];
+ }
+ full_name_on_stack[i] = '\0';
+
// TODO(erg): Remove this hack.
//
// This is a hack to force the name of the theme into the stack
// frame. Hopefully.
BuildFromExtension(extension, true);
UserMetrics::RecordAction("Themes.Migrated", profile_);
- LOG(ERROR) << "Migrating theme: " << name;
+ LOG(INFO) << "Migrating theme: " << full_name_on_stack;
}
void BrowserThemeProvider::BuildFromExtension(Extension* extension,
bool synchronously) {
+ CHECK(extension);
+
scoped_refptr<BrowserThemePack> pack =
BrowserThemePack::BuildFromExtension(extension);
if (!pack.get()) {
@@ -603,3 +621,9 @@ void BrowserThemeProvider::OnInfobarDestroyed() {
if (number_of_infobars_ == 0)
RemoveUnusedThemes();
}
+
+// No optimizations under windows until we know what's up with the crashing.
+#if defined(OS_WIN)
+#pragma warning(default:4748)
+#pragma optimize("", on)
+#endif