aboutsummaryrefslogtreecommitdiff
path: root/src/common/memory.h
diff options
context:
space:
mode:
authorbenchan@chromium.org <benchan@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-01-11 01:31:35 +0000
committerbenchan@chromium.org <benchan@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-01-11 01:31:35 +0000
commit577304f02af6be71c1587d3b880b2a55ac96145b (patch)
treec666d9cb5bbe02ed41a047cc816af4fd283028a9 /src/common/memory.h
parentClear error state flags in binarystream::rewind(). (diff)
downloadbreakpad-577304f02af6be71c1587d3b880b2a55ac96145b.tar.xz
Refactor LinuxDumper and MinidumpWriter.
This patch is part of a bigger patch that helps merging the breakpad code with the modified version in Chromium OS. Specifically, this patch makes the following changes: 1. Add two convenient methods, back() and empty(), to the wasteful_vector class. 2. Refactor the LinuxDumper class such that it can later be splitted into a base class and two derived classes, one uses the current ptrace implementation and one uses a core file. 3. Refactor the MinidumpWriter class such that it can later use different derived implementations of LinuxDumper. BUG=455 TEST=Tested the following: 1. Build on 32-bit and 64-bit Linux with gcc 4.4.3 and gcc 4.6. 2. Build on Mac OS X 10.6.8 with gcc 4.2 and clang 3.0 (with latest gmock). 3. All unit tests pass. Review URL: http://breakpad.appspot.com/340001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@902 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/memory.h')
-rw-r--r--src/common/memory.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/memory.h b/src/common/memory.h
index a02ac578..e90bd52c 100644
--- a/src/common/memory.h
+++ b/src/common/memory.h
@@ -145,6 +145,18 @@ class wasteful_vector {
used_(0) {
}
+ T& back() {
+ return a_[used_ - 1];
+ }
+
+ const T& back() const {
+ return a_[used_ - 1];
+ }
+
+ bool empty() const {
+ return used_ == 0;
+ }
+
void push_back(const T& new_element) {
if (used_ == allocated_)
Realloc(allocated_ * 2);