Update of /cvsroot/openvrml/openvrml/mozilla-plugin/src/openvrml-player
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16241/mozilla-plugin/src/openvrml-player
Modified Files:
player.cpp plugin_streambuf.cpp plugin_streambuf.h
Log Message:
Check whether the stream has been destroyed in plugin_streambuf::data_available. The streambuf should be treated as having data available once it has been "destroyed" by the Web browser so that EOF can be gotten from it.
Index: player.cpp
===================================================================
RCS file: /cvsroot/openvrml/openvrml/mozilla-plugin/src/openvrml-player/player.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** player.cpp 24 Jul 2006 07:25:00 -0000 1.27
--- player.cpp 2 Aug 2006 15:37:41 -0000 1.28
***************
*** 108,113 ****
continue;
}
! pos->second->buf_.put(std::char_traits<char>::eof());
! pos->second->buf_.npstream_destroyed();
plugin_streambuf_map.erase(pos);
} else if (command == "write") {
--- 108,112 ----
continue;
}
! pos->second->buf_.set_npstream_destroyed();
plugin_streambuf_map.erase(pos);
} else if (command == "write") {
Index: plugin_streambuf.cpp
===================================================================
RCS file: /cvsroot/openvrml/openvrml/mozilla-plugin/src/openvrml-player/plugin_streambuf.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** plugin_streambuf.cpp 24 Jul 2006 08:01:45 -0000 1.8
--- plugin_streambuf.cpp 2 Aug 2006 15:37:41 -0000 1.9
***************
*** 39,43 ****
this->end_ = (this->end_ + 1) % npstream_buffer::buffer_size;
++this->buffered_;
! this->buffer_not_empty_or_eof_.notify_one();
}
--- 39,43 ----
this->end_ = (this->end_ + 1) % npstream_buffer::buffer_size;
++this->buffered_;
! this->buffer_not_empty_or_eof_.notify_all();
}
***************
*** 67,75 ****
}
! void openvrml_player::plugin_streambuf::npstream_buffer::npstream_destroyed()
{
boost::mutex::scoped_lock lock(this->mutex_);
this->npstream_destroyed_ = true;
! this->buffer_not_empty_or_eof_.notify_one();
}
--- 67,82 ----
}
! void openvrml_player::plugin_streambuf::npstream_buffer::set_npstream_destroyed()
{
boost::mutex::scoped_lock lock(this->mutex_);
this->npstream_destroyed_ = true;
! this->buffer_not_empty_or_eof_.notify_all();
! }
!
! bool
! openvrml_player::plugin_streambuf::npstream_buffer::npstream_destroyed() const
! {
! boost::mutex::scoped_lock lock(this->mutex_);
! return this->npstream_destroyed_;
}
***************
*** 129,133 ****
bool openvrml_player::plugin_streambuf::data_available() const
{
! return this->buf_.buffered() > 0;
}
--- 136,145 ----
bool openvrml_player::plugin_streambuf::data_available() const
{
! //
! // It may seem a bit counterintuitive to return true here if the stream
! // has been destroyed; however, if we don't return true in this case,
! // clients may never get EOF from the stream.
! //
! return this->buf_.buffered() > 0 || this->buf_.npstream_destroyed();
}
Index: plugin_streambuf.h
===================================================================
RCS file: /cvsroot/openvrml/openvrml/mozilla-plugin/src/openvrml-player/plugin_streambuf.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** plugin_streambuf.h 24 Jul 2006 07:25:00 -0000 1.6
--- plugin_streambuf.h 2 Aug 2006 15:37:41 -0000 1.7
***************
*** 53,57 ****
int_type get();
size_t buffered() const;
! void npstream_destroyed();
};
--- 53,58 ----
int_type get();
size_t buffered() const;
! void set_npstream_destroyed();
! bool npstream_destroyed() const;
};
|