Roll src/third_party/WebKit 6b63e20:35e1984 (svn 201060:201061)
[chromium-blink-merge.git] / pdf / pdfium / pdfium_mem_buffer_file_write.cc
blob45e564b67baf7f08851ae00a03f325c8b7fc5f2f
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "pdf/pdfium/pdfium_mem_buffer_file_write.h"
7 namespace chrome_pdf {
9 PDFiumMemBufferFileWrite::PDFiumMemBufferFileWrite() {
10 version = 1;
11 WriteBlock = &WriteBlockImpl;
14 PDFiumMemBufferFileWrite::~PDFiumMemBufferFileWrite() {
17 int PDFiumMemBufferFileWrite::WriteBlockImpl(FPDF_FILEWRITE* this_file_write,
18 const void* data,
19 unsigned long size) {
20 PDFiumMemBufferFileWrite* mem_buffer_file_write =
21 static_cast<PDFiumMemBufferFileWrite*>(this_file_write);
22 return mem_buffer_file_write->DoWriteBlock(data, size);
25 int PDFiumMemBufferFileWrite::DoWriteBlock(const void* data,
26 unsigned long size) {
27 buffer_.append(static_cast<const unsigned char*>(data), size);
28 return 1;
32 } // namespace chrome_pdf