From: Braden M. <br...@us...> - 2006-08-04 04:59:22
|
Update of /cvsroot/openvrml/openvrml/mozilla-plugin/src/openvrml-player In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1041/mozilla-plugin/src/openvrml-player Modified Files: gtkvrmlbrowser.cpp player.cpp plugin_streambuf.cpp plugin_streambuf.h Log Message: Set the plugin_resource_istream initial state to invalid if the Web browser's get-url function fails. This means that the child process blocks until the Web browser has informed it of the validity of the get-url operation. Index: player.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/mozilla-plugin/src/openvrml-player/player.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** player.cpp 3 Aug 2006 23:32:52 -0000 1.29 --- player.cpp 4 Aug 2006 04:59:20 -0000 1.30 *************** *** 74,78 **** string command; command_line_stream >> command; ! if (command == "new-stream") { using boost::shared_ptr; --- 74,89 ---- string command; command_line_stream >> command; ! if (command == "get-url-result") { ! using boost::shared_ptr; ! ! std::string url; ! int result; ! command_line_stream >> url >> result; ! ! shared_ptr<plugin_streambuf> streambuf = ! uninitialized_plugin_streambuf_map_.find(url); ! assert(streambuf); ! streambuf->set_get_url_result(result); ! } else if (command == "new-stream") { using boost::shared_ptr; Index: plugin_streambuf.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/mozilla-plugin/src/openvrml-player/plugin_streambuf.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** plugin_streambuf.cpp 3 Aug 2006 23:32:52 -0000 1.10 --- plugin_streambuf.cpp 4 Aug 2006 04:59:20 -0000 1.11 *************** *** 24,27 **** --- 24,28 ---- openvrml_player::plugin_streambuf:: plugin_streambuf(const std::string & requested_url): + get_url_result_(-1), initialized_(false), url_(requested_url), *************** *** 40,43 **** --- 41,61 ---- } + void openvrml_player::plugin_streambuf::set_get_url_result(const int result) + { + boost::mutex::scoped_lock lock(this->mutex_); + assert(this->get_url_result_ == -1); + this->get_url_result_ = result; + this->received_get_url_result_.notify_all(); + } + + int openvrml_player::plugin_streambuf::get_url_result() const + { + boost::mutex::scoped_lock lock(this->mutex_); + while (this->get_url_result_ == -1) { + this->received_get_url_result_.wait(lock); + } + return this->get_url_result_; + } + void openvrml_player::plugin_streambuf::init(const size_t stream_id, const std::string & received_url, Index: gtkvrmlbrowser.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/mozilla-plugin/src/openvrml-player/gtkvrmlbrowser.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gtkvrmlbrowser.cpp 24 Jul 2006 07:25:00 -0000 1.5 --- gtkvrmlbrowser.cpp 4 Aug 2006 04:59:20 -0000 1.6 *************** *** 183,187 **** } ! void gtk_vrml_browser_class_init(GtkVrmlBrowserClass * klass) {} --- 183,187 ---- } ! void gtk_vrml_browser_class_init(GtkVrmlBrowserClass *) {} *************** *** 510,513 **** --- 510,521 ---- 0); g_io_channel_flush(this->request_channel_, 0); + + // + // This blocks until we know the result of NPN_GetURL. + // + const int get_url_result = this->streambuf_->get_url_result(); + if (get_url_result != 0) { + this->setstate(std::ios_base::failbit); + } } Index: plugin_streambuf.h =================================================================== RCS file: /cvsroot/openvrml/openvrml/mozilla-plugin/src/openvrml-player/plugin_streambuf.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** plugin_streambuf.h 3 Aug 2006 23:32:52 -0000 1.8 --- plugin_streambuf.h 4 Aug 2006 04:59:20 -0000 1.9 *************** *** 40,43 **** --- 40,45 ---- mutable boost::mutex mutex_; + int get_url_result_; + mutable boost::condition received_get_url_result_; bool initialized_; mutable boost::condition streambuf_initialized_; *************** *** 53,56 **** --- 55,60 ---- public: explicit plugin_streambuf(const std::string & requested_url); + void set_get_url_result(int result); + int get_url_result() const; void init(size_t stream_id, const std::string & received_url, |