| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 #include "platform/SharedBuffer.h" | 33 #include "platform/SharedBuffer.h" |
| 34 #include "wtf/PassRefPtr.h" | 34 #include "wtf/PassRefPtr.h" |
| 35 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.h" |
| 36 | 36 |
| 37 #include <algorithm> | 37 #include <algorithm> |
| 38 #include <cstring> | 38 #include <cstring> |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 SharedBufferReader::SharedBufferReader(PassRefPtr<SharedBuffer> buffer) | 42 SharedBufferReader::SharedBufferReader(PassRefPtr<const SharedBuffer> buffer) |
| 43 : m_buffer(buffer) | 43 : m_buffer(buffer) |
| 44 , m_currentOffset(0) | 44 , m_currentOffset(0) |
| 45 { | 45 { |
| 46 } | 46 } |
| 47 | 47 |
| 48 SharedBufferReader::~SharedBufferReader() | 48 SharedBufferReader::~SharedBufferReader() |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 int SharedBufferReader::readData(char* outputBuffer, int askedToRead) | 52 int SharedBufferReader::readData(char* outputBuffer, int askedToRead) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 67 segmentSize = std::min(segmentSize, lenToCopy - bytesCopied); | 67 segmentSize = std::min(segmentSize, lenToCopy - bytesCopied); |
| 68 memcpy(outputBuffer + bytesCopied, data, segmentSize); | 68 memcpy(outputBuffer + bytesCopied, data, segmentSize); |
| 69 bytesCopied += segmentSize; | 69 bytesCopied += segmentSize; |
| 70 m_currentOffset += segmentSize; | 70 m_currentOffset += segmentSize; |
| 71 } | 71 } |
| 72 | 72 |
| 73 return safeCast<int>(bytesCopied); | 73 return safeCast<int>(bytesCopied); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace blink | 76 } // namespace blink |
| OLD | NEW |