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

Side by Side Diff: third_party/WebKit/Source/platform/SharedBuffer.cpp

Issue 2206263003: Remove SK_SUPPORT_LEGACY_DATA_FACTORIES. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ref when needed. Created 4 years, 4 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
OLDNEW
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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 if (position != byteLength) { 255 if (position != byteLength) {
256 ASSERT_NOT_REACHED(); 256 ASSERT_NOT_REACHED();
257 // Don't return the incomplete data. 257 // Don't return the incomplete data.
258 return false; 258 return false;
259 } 259 }
260 260
261 return true; 261 return true;
262 } 262 }
263 263
264 PassRefPtr<SkData> SharedBuffer::getAsSkData() const 264 sk_sp<SkData> SharedBuffer::getAsSkData() const
265 { 265 {
266 size_t bufferLength = size(); 266 size_t bufferLength = size();
267 SkData* data = SkData::NewUninitialized(bufferLength); 267 sk_sp<SkData> data = SkData::MakeUninitialized(bufferLength);
268 char* buffer = static_cast<char*>(data->writable_data()); 268 char* buffer = static_cast<char*>(data->writable_data());
269 const char* segment = 0; 269 const char* segment = 0;
270 size_t position = 0; 270 size_t position = 0;
271 while (size_t segmentSize = getSomeDataInternal(segment, position)) { 271 while (size_t segmentSize = getSomeDataInternal(segment, position)) {
272 memcpy(buffer + position, segment, segmentSize); 272 memcpy(buffer + position, segment, segmentSize);
273 position += segmentSize; 273 position += segmentSize;
274 } 274 }
275 275
276 if (position != bufferLength) { 276 if (position != bufferLength) {
277 ASSERT_NOT_REACHED(); 277 ASSERT_NOT_REACHED();
278 // Don't return the incomplete SkData. 278 // Don't return the incomplete SkData.
279 return nullptr; 279 return nullptr;
280 } 280 }
281 return adoptRef(data); 281 return data;
282 } 282 }
283 283
284 bool SharedBuffer::lock() 284 bool SharedBuffer::lock()
285 { 285 {
286 return m_buffer.lock(); 286 return m_buffer.lock();
287 } 287 }
288 288
289 void SharedBuffer::unlock() 289 void SharedBuffer::unlock()
290 { 290 {
291 mergeSegmentsIntoBuffer(); 291 mergeSegmentsIntoBuffer();
(...skipping 13 matching lines...) Expand all
305 // If there is data in the segments, then it should have been allocated 305 // If there is data in the segments, then it should have been allocated
306 // using fastMalloc. 306 // using fastMalloc.
307 const String dataDumpName = dumpPrefix + "/segments"; 307 const String dataDumpName = dumpPrefix + "/segments";
308 auto dump = memoryDump->createMemoryAllocatorDump(dataDumpName); 308 auto dump = memoryDump->createMemoryAllocatorDump(dataDumpName);
309 dump->addScalar("size", "bytes", m_size); 309 dump->addScalar("size", "bytes", m_size);
310 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllo catedObjectPoolName)); 310 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllo catedObjectPoolName));
311 } 311 }
312 } 312 }
313 313
314 } // namespace blink 314 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/SharedBuffer.h ('k') | third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698