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

Side by Side Diff: Source/core/html/canvas/DataView.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
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 29 matching lines...) Expand all
40 }; 40 };
41 41
42 } 42 }
43 43
44 namespace WebCore { 44 namespace WebCore {
45 45
46 PassRefPtr<DataView> DataView::create(unsigned length) 46 PassRefPtr<DataView> DataView::create(unsigned length)
47 { 47 {
48 RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(length, sizeof(uint8_t)); 48 RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(length, sizeof(uint8_t));
49 if (!buffer.get()) 49 if (!buffer.get())
50 return 0; 50 return nullptr;
51 return create(buffer, 0, length); 51 return create(buffer, 0, length);
52 } 52 }
53 53
54 PassRefPtr<DataView> DataView::create(PassRefPtr<ArrayBuffer> buffer, unsigned b yteOffset, unsigned byteLength) 54 PassRefPtr<DataView> DataView::create(PassRefPtr<ArrayBuffer> buffer, unsigned b yteOffset, unsigned byteLength)
55 { 55 {
56 if (byteOffset > buffer->byteLength()) 56 if (byteOffset > buffer->byteLength())
57 return 0; 57 return nullptr;
58 CheckedInt<uint32_t> checkedOffset(byteOffset); 58 CheckedInt<uint32_t> checkedOffset(byteOffset);
59 CheckedInt<uint32_t> checkedLength(byteLength); 59 CheckedInt<uint32_t> checkedLength(byteLength);
60 CheckedInt<uint32_t> checkedMax = checkedOffset + checkedLength; 60 CheckedInt<uint32_t> checkedMax = checkedOffset + checkedLength;
61 if (!checkedMax.isValid() || checkedMax.value() > buffer->byteLength()) 61 if (!checkedMax.isValid() || checkedMax.value() > buffer->byteLength())
62 return 0; 62 return nullptr;
63 return adoptRef(new DataView(buffer, byteOffset, byteLength)); 63 return adoptRef(new DataView(buffer, byteOffset, byteLength));
64 } 64 }
65 65
66 DataView::DataView(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned byteLength) 66 DataView::DataView(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned byteLength)
67 : ArrayBufferView(buffer, byteOffset) 67 : ArrayBufferView(buffer, byteOffset)
68 , m_byteLength(byteLength) 68 , m_byteLength(byteLength)
69 { 69 {
70 ScriptWrappable::init(this); 70 ScriptWrappable::init(this);
71 } 71 }
72 72
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 setData<double>(byteOffset, value, littleEndian, exceptionState); 239 setData<double>(byteOffset, value, littleEndian, exceptionState);
240 } 240 }
241 241
242 void DataView::neuter() 242 void DataView::neuter()
243 { 243 {
244 ArrayBufferView::neuter(); 244 ArrayBufferView::neuter();
245 m_byteLength = 0; 245 m_byteLength = 0;
246 } 246 }
247 247
248 } 248 }
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasStyle.cpp ('k') | Source/core/html/canvas/OESVertexArrayObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698