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

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

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/PODRedBlackTree.h ('k') | Source/platform/animation/AnimationValue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 const char* segment = 0; 424 const char* segment = 0;
425 unsigned position = 0; 425 unsigned position = 0;
426 while (unsigned segmentSize = getSomeData(segment, position)) { 426 while (unsigned segmentSize = getSomeData(segment, position)) {
427 memcpy(static_cast<char*>(arrayBuffer->data()) + position, segment, segm entSize); 427 memcpy(static_cast<char*>(arrayBuffer->data()) + position, segment, segm entSize);
428 position += segmentSize; 428 position += segmentSize;
429 } 429 }
430 430
431 if (position != arrayBuffer->byteLength()) { 431 if (position != arrayBuffer->byteLength()) {
432 ASSERT_NOT_REACHED(); 432 ASSERT_NOT_REACHED();
433 // Don't return the incomplete ArrayBuffer. 433 // Don't return the incomplete ArrayBuffer.
434 return 0; 434 return nullptr;
435 } 435 }
436 436
437 return arrayBuffer; 437 return arrayBuffer;
438 } 438 }
439 439
440 PassRefPtr<SkData> SharedBuffer::getAsSkData() const 440 PassRefPtr<SkData> SharedBuffer::getAsSkData() const
441 { 441 {
442 unsigned bufferLength = size(); 442 unsigned bufferLength = size();
443 char* buffer = static_cast<char*>(sk_malloc_throw(bufferLength)); 443 char* buffer = static_cast<char*>(sk_malloc_throw(bufferLength));
444 const char* segment = 0; 444 const char* segment = 0;
445 unsigned position = 0; 445 unsigned position = 0;
446 while (unsigned segmentSize = getSomeData(segment, position)) { 446 while (unsigned segmentSize = getSomeData(segment, position)) {
447 memcpy(buffer + position, segment, segmentSize); 447 memcpy(buffer + position, segment, segmentSize);
448 position += segmentSize; 448 position += segmentSize;
449 } 449 }
450 450
451 if (position != bufferLength) { 451 if (position != bufferLength) {
452 ASSERT_NOT_REACHED(); 452 ASSERT_NOT_REACHED();
453 // Don't return the incomplete SkData. 453 // Don't return the incomplete SkData.
454 return 0; 454 return nullptr;
455 } 455 }
456 return adoptRef(SkData::NewFromMalloc(buffer, bufferLength)); 456 return adoptRef(SkData::NewFromMalloc(buffer, bufferLength));
457 } 457 }
458 458
459 } // namespace WebCore 459 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/PODRedBlackTree.h ('k') | Source/platform/animation/AnimationValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698