mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Add MayBlock() method to stream classes which is used as a hint when determining the thread to access the stream from (issue #1187).
- In cases where MayBlock() returns true have CefStreamResourceReader perform the reads on the FILE thread (issue #1187). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1582 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -20,6 +20,7 @@ class CefFileReader : public CefStreamReader {
|
||||
virtual int Seek(int64 offset, int whence) OVERRIDE;
|
||||
virtual int64 Tell() OVERRIDE;
|
||||
virtual int Eof() OVERRIDE;
|
||||
virtual bool MayBlock() OVERRIDE { return true; }
|
||||
|
||||
protected:
|
||||
bool close_;
|
||||
@ -39,6 +40,7 @@ class CefFileWriter : public CefStreamWriter {
|
||||
virtual int Seek(int64 offset, int whence) OVERRIDE;
|
||||
virtual int64 Tell() OVERRIDE;
|
||||
virtual int Flush() OVERRIDE;
|
||||
virtual bool MayBlock() OVERRIDE { return true; }
|
||||
|
||||
protected:
|
||||
FILE* file_;
|
||||
@ -58,6 +60,7 @@ class CefBytesReader : public CefStreamReader {
|
||||
virtual int Seek(int64 offset, int whence) OVERRIDE;
|
||||
virtual int64 Tell() OVERRIDE;
|
||||
virtual int Eof() OVERRIDE;
|
||||
virtual bool MayBlock() OVERRIDE { return false; }
|
||||
|
||||
void SetData(void* data, int64 datasize, bool copy);
|
||||
|
||||
@ -84,6 +87,7 @@ class CefBytesWriter : public CefStreamWriter {
|
||||
virtual int Seek(int64 offset, int whence) OVERRIDE;
|
||||
virtual int64 Tell() OVERRIDE;
|
||||
virtual int Flush() OVERRIDE;
|
||||
virtual bool MayBlock() OVERRIDE { return false; }
|
||||
|
||||
void* GetData() { return data_; }
|
||||
int64 GetDataSize() { return offset_; }
|
||||
@ -119,6 +123,9 @@ class CefHandlerReader : public CefStreamReader {
|
||||
virtual int Eof() OVERRIDE {
|
||||
return handler_->Eof();
|
||||
}
|
||||
virtual bool MayBlock() OVERRIDE {
|
||||
return handler_->MayBlock();
|
||||
}
|
||||
|
||||
protected:
|
||||
CefRefPtr<CefReadHandler> handler_;
|
||||
@ -144,6 +151,9 @@ class CefHandlerWriter : public CefStreamWriter {
|
||||
virtual int Flush() OVERRIDE {
|
||||
return handler_->Flush();
|
||||
}
|
||||
virtual bool MayBlock() OVERRIDE {
|
||||
return handler_->MayBlock();
|
||||
}
|
||||
|
||||
protected:
|
||||
CefRefPtr<CefWriteHandler> handler_;
|
||||
|
Reference in New Issue
Block a user