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

Unified Diff: base/ref_counted_memory.cc

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/ref_counted_memory.h ('k') | chrome/browser/dom_ui/chrome_url_data_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/ref_counted_memory.cc
diff --git a/base/ref_counted_memory.cc b/base/ref_counted_memory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..04a26342926cfecbf1f421070981b5ed5b67b20f
--- /dev/null
+++ b/base/ref_counted_memory.cc
@@ -0,0 +1,37 @@
+// 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.
+
+#include "base/ref_counted_memory.h"
+
+const unsigned char* RefCountedStaticMemory::front() const {
+ return data_;
+}
+
+size_t RefCountedStaticMemory::size() const {
+ return length_;
+}
+
+RefCountedBytes* RefCountedBytes::TakeVector(
+ std::vector<unsigned char>* to_destroy) {
+ RefCountedBytes* bytes = new RefCountedBytes;
+ bytes->data.swap(*to_destroy);
+ return bytes;
+}
+
+RefCountedBytes::RefCountedBytes() {
+}
+
+RefCountedBytes::RefCountedBytes(const std::vector<unsigned char>& initializer)
+ : data(initializer) {
+}
+
+const unsigned char* RefCountedBytes::front() const {
+ // STL will assert if we do front() on an empty vector, but calling code
+ // expects a NULL.
+ return size() ? &data.front() : NULL;
+}
+
+size_t RefCountedBytes::size() const {
+ return data.size();
+}
« no previous file with comments | « base/ref_counted_memory.h ('k') | chrome/browser/dom_ui/chrome_url_data_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698