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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/ref_counted_memory.h"
6
7 const unsigned char* RefCountedStaticMemory::front() const {
8 return data_;
9 }
10
11 size_t RefCountedStaticMemory::size() const {
12 return length_;
13 }
14
15 RefCountedBytes* RefCountedBytes::TakeVector(
16 std::vector<unsigned char>* to_destroy) {
17 RefCountedBytes* bytes = new RefCountedBytes;
18 bytes->data.swap(*to_destroy);
19 return bytes;
20 }
21
22 RefCountedBytes::RefCountedBytes() {
23 }
24
25 RefCountedBytes::RefCountedBytes(const std::vector<unsigned char>& initializer)
26 : data(initializer) {
27 }
28
29 const unsigned char* RefCountedBytes::front() const {
30 // STL will assert if we do front() on an empty vector, but calling code
31 // expects a NULL.
32 return size() ? &data.front() : NULL;
33 }
34
35 size_t RefCountedBytes::size() const {
36 return data.size();
37 }
OLDNEW
« 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