blob: 84b1714057fe44d2f56643f093200c5abdbb0879 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001/*
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.comc5aeccd2011-07-17 14:42:08 +00007#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();
rmistry@google.comd6176b02012-08-23 18:14:13 +000017
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000018 virtual void* requestBlock(size_t minRequest, size_t* actual);
19 virtual void notifyWritten(size_t bytes);
rmistry@google.comd6176b02012-08-23 18:14:13 +000020
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000021 int writeToSocket(SkSocket* sockfd, SkSocket::DataType type);
22 void enablePlayback() { fPlayback = true; }
23 void disablePlayback() { fPlayback = false; }
rmistry@google.comd6176b02012-08-23 18:14:13 +000024
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000025private:
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.comd6176b02012-08-23 18:14:13 +000033
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000034 SkGPipeReader::Status fStatus;
35};
rmistry@google.combda03db2012-08-14 20:27:54 +000036#endif