1/* 2 * Copyright 2011 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7#ifndef SkNetPipeController_DEFINED 8#define SkNetPipeController_DEFINED 9#include "SkTypes.h" 10#include "SkCanvas.h" 11#include "SkGPipe.h" 12#include "SkSockets.h" 13class SkNetPipeController : public SkGPipeController { 14public: 15 SkNetPipeController(SkCanvas* target); 16 ~SkNetPipeController(); 17 18 virtual void* requestBlock(size_t minRequest, size_t* actual); 19 virtual void notifyWritten(size_t bytes); 20 21 int writeToSocket(SkSocket* sockfd, SkSocket::DataType type); 22 void enablePlayback() { fPlayback = true; } 23 void disablePlayback() { fPlayback = false; } 24 25private: 26 SkGPipeReader fReader; 27 bool fPlayback; 28 void* fBlock; 29 size_t fBlockSize; 30 size_t fBytesWritten; 31 int fAtomsWritten; 32 size_t fTotalWritten; 33 34 SkGPipeReader::Status fStatus; 35}; 36#endif 37