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

Unified Diff: base/values.h

Issue 10388207: Reverting due to memory waterfall failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | « no previous file | base/values.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values.h
===================================================================
--- base/values.h (revision 138049)
+++ base/values.h (working copy)
@@ -30,7 +30,6 @@
#include "base/base_export.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
// This file declares "using base::Value", etc. at the bottom, so that
@@ -178,32 +177,33 @@
class BASE_EXPORT BinaryValue: public Value {
public:
- // Creates a BinaryValue with a null buffer and size of 0.
- BinaryValue();
+ virtual ~BinaryValue();
- // Creates a BinaryValue, taking ownership of the bytes pointed to by
- // |buffer|.
- BinaryValue(scoped_ptr<char> buffer, size_t size);
+ // Creates a Value to represent a binary buffer. The new object takes
+ // ownership of the pointer passed in, if successful.
+ // Returns NULL if buffer is NULL.
+ static BinaryValue* Create(char* buffer, size_t size);
- virtual ~BinaryValue();
-
// For situations where you want to keep ownership of your buffer, this
// factory method creates a new BinaryValue by copying the contents of the
// buffer that's passed in.
+ // Returns NULL if buffer is NULL.
static BinaryValue* CreateWithCopiedBuffer(const char* buffer, size_t size);
size_t GetSize() const { return size_; }
+ char* GetBuffer() { return buffer_; }
+ const char* GetBuffer() const { return buffer_; }
- // May return NULL.
- char* GetBuffer() { return buffer_.get(); }
- const char* GetBuffer() const { return buffer_.get(); }
-
// Overridden from Value:
virtual BinaryValue* DeepCopy() const OVERRIDE;
virtual bool Equals(const Value* other) const OVERRIDE;
private:
- scoped_ptr<char> buffer_;
+ // Constructor is private so that only objects with valid buffer pointers
+ // and size values can be created.
+ BinaryValue(char* buffer, size_t size);
+
+ char* buffer_;
size_t size_;
DISALLOW_COPY_AND_ASSIGN(BinaryValue);
« no previous file with comments | « no previous file | base/values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698