Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: base/stack_container.h

Issue 6258: This CL is due the thread I have made on chromium-dev:... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/scoped_ptr.h ('k') | base/thread_collision_warner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/stack_container.h
===================================================================
--- base/stack_container.h (revision 3911)
+++ base/stack_container.h (working copy)
@@ -9,6 +9,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/thread_collision_warner.h"
// This allocator can be used with STL containers to provide a stack buffer
// from which to allocate memory and overflows onto the heap. This stack buffer
@@ -152,8 +153,14 @@
// Support operator-> to get to the container. This allows nicer syntax like:
// StackContainer<...> foo;
// std::sort(foo->begin(), foo->end());
- ContainerType* operator->() { return &container_; }
- const ContainerType* operator->() const { return &container_; }
+ ContainerType* operator->() {
+ D_BOOK_CRITICAL_SECTION(arrow_operator_);
+ return &container_;
+ }
+ const ContainerType* operator->() const {
+ D_BOOK_CRITICAL_SECTION(arrow_operator_);
+ return &container_;
+ }
#ifdef UNIT_TEST
// Retrieves the stack source so that that unit tests can verify that the
@@ -168,6 +175,8 @@
Allocator allocator_;
ContainerType container_;
+ D_DEFINE_CRITICAL_SECTION(arrow_operator_);
+
DISALLOW_EVIL_CONSTRUCTORS(StackContainer);
};
« no previous file with comments | « base/scoped_ptr.h ('k') | base/thread_collision_warner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698