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