summaryrefslogtreecommitdiffstats
path: root/courgette/memory_allocator.h
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-03 23:39:32 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-03 23:39:32 +0000
commit6c1319541aee6ff89c06457b46d46bbcbcfe868f (patch)
tree45eda090e3e17f5c7247dd4b1ec6649bfde4d04d /courgette/memory_allocator.h
parent4006448408b35ca6be5aef5db1be1e966d31eee4 (diff)
downloadchromium_src-6c1319541aee6ff89c06457b46d46bbcbcfe868f.zip
chromium_src-6c1319541aee6ff89c06457b46d46bbcbcfe868f.tar.gz
chromium_src-6c1319541aee6ff89c06457b46d46bbcbcfe868f.tar.bz2
Instrument the allocator code so that we can track down the cause of recent crashes.
BUG=74777 TEST=This should give us a clearer picture of what's going wrong in the recent courgette crashes. Review URL: http://codereview.chromium.org/6611027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76834 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/memory_allocator.h')
-rw-r--r--courgette/memory_allocator.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/courgette/memory_allocator.h b/courgette/memory_allocator.h
index 8e06e65..fce1e25 100644
--- a/courgette/memory_allocator.h
+++ b/courgette/memory_allocator.h
@@ -8,6 +8,7 @@
#include <memory>
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "base/logging.h"
#include "base/platform_file.h"
@@ -24,9 +25,9 @@ class TempFile {
TempFile();
~TempFile();
- bool Create();
+ __declspec(noinline) void Create();
void Close();
- bool SetSize(size_t size);
+ __declspec(noinline) void SetSize(size_t size);
// Returns true iff the temp file is currently open.
bool valid() const;
@@ -40,6 +41,8 @@ class TempFile {
size_t size() const;
protected:
+ __declspec(noinline) FilePath PrepareTempFile();
+
base::PlatformFile file_;
size_t size_;
};
@@ -51,7 +54,7 @@ class FileMapping {
~FileMapping();
// Map a file from beginning to |size|.
- bool Create(HANDLE file, size_t size);
+ __declspec(noinline) void Create(HANDLE file, size_t size);
void Close();
// Returns true iff a mapping has been created.
@@ -62,6 +65,8 @@ class FileMapping {
void* view() const;
protected:
+ __declspec(noinline) void InitializeView(size_t size);
+
HANDLE mapping_;
void* view_;
};
@@ -77,7 +82,7 @@ class TempMapping {
// Creates a temporary file of size |size| and maps it into the current
// process' address space.
- bool Initialize(size_t size);
+ __declspec(noinline) void Initialize(size_t size);
// Returns a writable pointer to the reserved memory.
void* memory() const;
@@ -179,10 +184,7 @@ class MemoryAllocator {
// If either the heap allocation failed or the request exceeds the
// max heap allocation threshold, we back the allocation with a temp file.
TempMapping* mapping = new TempMapping();
- if (!mapping->Initialize(bytes)) {
- delete mapping;
- throw std::bad_alloc("TempMapping::Initialize");
- }
+ mapping->Initialize(bytes);
mem = reinterpret_cast<uint8*>(mapping->memory());
mem[0] = static_cast<uint8>(FILE_ALLOCATION);
}