diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 19:49:35 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 19:49:35 +0000 |
commit | 91240c947358b33cc19c0923a06d116ab36737dd (patch) | |
tree | 7897c99ad9b41d7735c7a42e0ea75fe6f76760b3 /o3d/import/cross/tar_processor.cc | |
parent | 2e25a9f4152a90a179ad37206bff79e1198379d7 (diff) | |
download | chromium_src-91240c947358b33cc19c0923a06d116ab36737dd.zip chromium_src-91240c947358b33cc19c0923a06d116ab36737dd.tar.gz chromium_src-91240c947358b33cc19c0923a06d116ab36737dd.tar.bz2 |
Asynchronous tick now uses NPN_PluginAsyncCall.URL streaming callbacks are now also asynchronous.Implemented NPN_PluginAsyncCall for IE.Allowed WM_PAINT handler to be reentered because it no longer calls into the browser (except to schedule an asynchronous tick if none is pending).Fixed a bug where the EventManager would crash if an event callback called cleanUp on the client.Cleanup destroys all the packs. Doing this in NPP_Destroy seems to make Chrome timeout and fail to load the next page.Tar and GZ decoding happens on a new thread.
Review URL: http://codereview.chromium.org/155733
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22305 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/import/cross/tar_processor.cc')
-rw-r--r-- | o3d/import/cross/tar_processor.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/o3d/import/cross/tar_processor.cc b/o3d/import/cross/tar_processor.cc index 7b14c22..b4c268e 100644 --- a/o3d/import/cross/tar_processor.cc +++ b/o3d/import/cross/tar_processor.cc @@ -41,7 +41,8 @@ static const int kFileSizeOffset = 124; static const int kLinkFlagOffset = 156; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -int TarProcessor::ProcessBytes(MemoryReadStream *stream, size_t n) { +StreamProcessor::Status TarProcessor::ProcessBytes(MemoryReadStream *stream, + size_t n) { // Keep processing the byte-stream until we've consumed all we're given // size_t bytes_to_consume = n; @@ -56,7 +57,7 @@ int TarProcessor::ProcessBytes(MemoryReadStream *stream, size_t n) { stream->Read(reinterpret_cast<uint8*>(header_ + header_bytes_read_), bytes_to_read); if (bytes_read != bytes_to_read) { - return -1; + return FAILURE; } header_bytes_read_ += bytes_to_read; @@ -73,7 +74,7 @@ int TarProcessor::ProcessBytes(MemoryReadStream *stream, size_t n) { getting_filename_ = true; // We should pick some size that's too large. if (file_size > 1024) { - return -1; + return FAILURE; } } else { getting_filename_ = false; @@ -92,10 +93,10 @@ int TarProcessor::ProcessBytes(MemoryReadStream *stream, size_t n) { ArchiveFileInfo info(filename, file_size); callback_client_->ReceiveFileHeader(info); } else if (header_[0] == 0) { - // If filename is NULL due to zero-padding then file size - // should also be NULL - // TODO(gman): Won't this crash the plugin if I make a bad tar? - assert(file_size == 0); + // If filename is empty due to zero-padding then file size + // should also be zero. + if (file_size != 0) + return FAILURE; } } @@ -134,7 +135,7 @@ int TarProcessor::ProcessBytes(MemoryReadStream *stream, size_t n) { } else { if (!callback_client_->ReceiveFileData(&client_read_stream, client_bytes_this_time)) { - return -1; + return FAILURE; } } @@ -166,7 +167,11 @@ int TarProcessor::ProcessBytes(MemoryReadStream *stream, size_t n) { } } - return 0; + return IN_PROGRESS; +} + +void TarProcessor::Close(bool success) { + callback_client_->Close(success); } } // namespace o3d |