OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 | 63 |
64 SharedBuffer::~SharedBuffer() { | 64 SharedBuffer::~SharedBuffer() { |
65 Clear(); | 65 Clear(); |
66 } | 66 } |
67 | 67 |
68 PassRefPtr<SharedBuffer> SharedBuffer::AdoptVector(Vector<char>& vector) { | 68 PassRefPtr<SharedBuffer> SharedBuffer::AdoptVector(Vector<char>& vector) { |
69 RefPtr<SharedBuffer> buffer = Create(); | 69 RefPtr<SharedBuffer> buffer = Create(); |
70 buffer->buffer_.swap(vector); | 70 buffer->buffer_.swap(vector); |
71 buffer->size_ = buffer->buffer_.size(); | 71 buffer->size_ = buffer->buffer_.size(); |
72 return buffer.Release(); | 72 return buffer; |
73 } | 73 } |
74 | 74 |
75 size_t SharedBuffer::size() const { | 75 size_t SharedBuffer::size() const { |
76 return size_; | 76 return size_; |
77 } | 77 } |
78 | 78 |
79 const char* SharedBuffer::Data() const { | 79 const char* SharedBuffer::Data() const { |
80 MergeSegmentsIntoBuffer(); | 80 MergeSegmentsIntoBuffer(); |
81 return buffer_.data(); | 81 return buffer_.data(); |
82 } | 82 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 // using fastMalloc. | 256 // using fastMalloc. |
257 const String data_dump_name = dump_prefix + "/segments"; | 257 const String data_dump_name = dump_prefix + "/segments"; |
258 auto dump = memory_dump->CreateMemoryAllocatorDump(data_dump_name); | 258 auto dump = memory_dump->CreateMemoryAllocatorDump(data_dump_name); |
259 dump->AddScalar("size", "bytes", size_); | 259 dump->AddScalar("size", "bytes", size_); |
260 memory_dump->AddSuballocation( | 260 memory_dump->AddSuballocation( |
261 dump->Guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); | 261 dump->Guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); |
262 } | 262 } |
263 } | 263 } |
264 | 264 |
265 } // namespace blink | 265 } // namespace blink |
OLD | NEW |