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

Unified Diff: base/ref_counted_memory.h

Issue 3061009: Speculative fix for crash in DOMUIThumbnailSource. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: msvc++ caught this Created 10 years, 5 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/base.gypi ('k') | base/ref_counted_memory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/ref_counted_memory.h
diff --git a/base/ref_counted_memory.h b/base/ref_counted_memory.h
index a5323cd40d29009a13a0117d7376ca91ce38584d..9ff83351729cc5c4bf6553a6bc8b2fcd8efbad77 100644
--- a/base/ref_counted_memory.h
+++ b/base/ref_counted_memory.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -40,8 +40,8 @@ class RefCountedStaticMemory : public RefCountedMemory {
RefCountedStaticMemory(const unsigned char* data, size_t length)
: data_(data), length_(length) {}
- virtual const unsigned char* front() const { return data_; }
- virtual size_t size() const { return length_; }
+ virtual const unsigned char* front() const;
+ virtual size_t size() const;
private:
const unsigned char* data_;
@@ -57,24 +57,15 @@ class RefCountedBytes : public RefCountedMemory {
// Constructs a RefCountedBytes object by performing a swap. (To non
// destructively build a RefCountedBytes, use the constructor that takes a
// vector.)
- static RefCountedBytes* TakeVector(std::vector<unsigned char>* to_destroy) {
- RefCountedBytes* bytes = new RefCountedBytes;
- bytes->data.swap(*to_destroy);
- return bytes;
- }
+ static RefCountedBytes* TakeVector(std::vector<unsigned char>* to_destroy);
- RefCountedBytes() {}
+ RefCountedBytes();
// Constructs a RefCountedBytes object by _copying_ from |initializer|.
- RefCountedBytes(const std::vector<unsigned char>& initializer)
- : data(initializer) {}
-
- virtual const unsigned char* front() const {
- // STL will assert if we do front() on an empty vector, but calling code
- // expects a NULL.
- return size() ? &data.front() : NULL;
- }
- virtual size_t size() const { return data.size(); }
+ RefCountedBytes(const std::vector<unsigned char>& initializer);
+
+ virtual const unsigned char* front() const;
+ virtual size_t size() const;
std::vector<unsigned char> data;
« no previous file with comments | « base/base.gypi ('k') | base/ref_counted_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698