epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 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 | */ |
yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 7 | #ifndef SkNetPipeController_DEFINED |
| 8 | #define SkNetPipeController_DEFINED |
| 9 | #include "SkTypes.h" |
| 10 | #include "SkCanvas.h" |
| 11 | #include "SkGPipe.h" |
| 12 | #include "SkSockets.h" |
| 13 | class SkNetPipeController : public SkGPipeController { |
| 14 | public: |
| 15 | SkNetPipeController(SkCanvas* target); |
| 16 | ~SkNetPipeController(); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 17 | |
yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 18 | virtual void* requestBlock(size_t minRequest, size_t* actual); |
| 19 | virtual void notifyWritten(size_t bytes); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 20 | |
yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 21 | int writeToSocket(SkSocket* sockfd, SkSocket::DataType type); |
| 22 | void enablePlayback() { fPlayback = true; } |
| 23 | void disablePlayback() { fPlayback = false; } |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 24 | |
yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 25 | private: |
| 26 | SkGPipeReader fReader; |
| 27 | bool fPlayback; |
| 28 | void* fBlock; |
| 29 | size_t fBlockSize; |
| 30 | size_t fBytesWritten; |
| 31 | int fAtomsWritten; |
| 32 | size_t fTotalWritten; |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 33 | |
yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 34 | SkGPipeReader::Status fStatus; |
| 35 | }; |
rmistry@google.com | bda03db | 2012-08-14 20:27:54 +0000 | [diff] [blame] | 36 | #endif |