You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(128) |
Dec
(65) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(48) |
Feb
(132) |
Mar
(95) |
Apr
(47) |
May
(54) |
Jun
(2) |
Jul
(57) |
Aug
(109) |
Sep
(131) |
Oct
(186) |
Nov
(105) |
Dec
(78) |
| 2007 |
Jan
(125) |
Feb
(105) |
Mar
(52) |
Apr
(104) |
May
(63) |
Jun
(116) |
Jul
(76) |
Aug
|
Sep
(18) |
Oct
(93) |
Nov
(110) |
Dec
(169) |
| 2008 |
Jan
(90) |
Feb
(64) |
Mar
(41) |
Apr
(23) |
May
(6) |
Jun
(18) |
Jul
(10) |
Aug
(61) |
Sep
(139) |
Oct
(50) |
Nov
(55) |
Dec
(2) |
| 2009 |
Jan
|
Feb
(1) |
Mar
(62) |
Apr
(22) |
May
(17) |
Jun
(19) |
Jul
(40) |
Aug
(21) |
Sep
|
Oct
(40) |
Nov
(23) |
Dec
|
| 2010 |
Jan
(14) |
Feb
(40) |
Mar
(9) |
Apr
(11) |
May
(19) |
Jun
(4) |
Jul
(10) |
Aug
(22) |
Sep
(15) |
Oct
|
Nov
(2) |
Dec
|
| 2011 |
Jan
(13) |
Feb
(10) |
Mar
|
Apr
(13) |
May
|
Jun
|
Jul
(2) |
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(33) |
May
(20) |
Jun
|
Jul
(8) |
Aug
(7) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
|
From: <br...@us...> - 2009-03-24 05:49:51
|
Revision: 3866
http://openvrml.svn.sourceforge.net/openvrml/?rev=3866&view=rev
Author: braden
Date: 2009-03-24 05:49:46 +0000 (Tue, 24 Mar 2009)
Log Message:
-----------
Moved Mozilla plug-in build into the big nonrecursive makefile.
Modified Paths:
--------------
trunk/ChangeLog
trunk/configure.ac
trunk/src/Makefile.am
Removed Paths:
-------------
trunk/src/mozilla-plugin/Makefile.am
Property Changed:
----------------
trunk/src/mozilla-plugin/
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-24 05:01:18 UTC (rev 3865)
+++ trunk/ChangeLog 2009-03-24 05:49:46 UTC (rev 3866)
@@ -1,5 +1,13 @@
2009-03-24 Braden McDaniel <br...@en...>
+ Moved Mozilla plug-in build into the big nonrecursive makefile.
+
+ * configure.ac: No longer emit src/mozilla-plugin/Makefile.
+ * src/Makefile.am: Build the Mozilla plug-in.
+ * src/mozilla-plugin/Makefile.am: Removed.
+
+2009-03-24 Braden McDaniel <br...@en...>
+
Moved Mozilla plug-in source to src/mozilla-plugin.
* Makefile (SUBDIRS): Removed mozilla-plugin.
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-03-24 05:01:18 UTC (rev 3865)
+++ trunk/configure.ac 2009-03-24 05:49:46 UTC (rev 3866)
@@ -16,7 +16,6 @@
[src/script/java/vrml/Makefile]
[src/script/java/vrml/field/Makefile]
[src/script/java/vrml/node/Makefile]
- [src/mozilla-plugin/Makefile]
[data/Makefile]
[examples/Makefile]
[tests/Makefile]
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-03-24 05:01:18 UTC (rev 3865)
+++ trunk/src/Makefile.am 2009-03-24 05:49:46 UTC (rev 3866)
@@ -1,4 +1,4 @@
-SUBDIRS = script mozilla-plugin
+SUBDIRS = script
BUILT_SOURCES =
@@ -857,6 +857,48 @@
--output=$@ \
$?
+mozpluginsdir = $(libdir)/mozilla/plugins
+if ENABLE_MOZILLA_PLUGIN
+mozplugins_LTLIBRARIES = mozilla-plugin/openvrml.la
+BUILT_SOURCES += \
+ mozilla-plugin/browser-host-server-glue.h \
+ mozilla-plugin/browser-factory-client-glue.h \
+ mozilla-plugin/browser-client-glue.h
+endif
+
+mozilla_plugin_openvrml_la_CPPFLAGS = \
+ -DMOZ_X11 \
+ -DGTK_DISABLE_DEPRECATED \
+ -DOPENVRML_LIBEXECDIR_=\"$(libexecdir)\" \
+ -Imozilla-plugin
+mozilla_plugin_openvrml_la_CXXFLAGS = \
+ $(MOZILLA_PLUGIN_CFLAGS) \
+ $(DBUS_G_CFLAGS)
+mozilla_plugin_openvrml_la_SOURCES = mozilla-plugin/openvrml.cpp
+mozilla_plugin_openvrml_la_LDFLAGS = \
+ -module -avoid-version \
+ $(MOZILLA_PLUGIN_LIBS) \
+ $(DBUS_G_LIBS)
+
+mozilla-plugin/browser-host-server-glue.h: $(srcdir)/openvrml-xembed/browser-host.xml
+ $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
+ --prefix=openvrml_np_browser_host \
+ --mode=glib-server \
+ --output=$@ \
+ $?
+
+mozilla-plugin/browser-factory-client-glue.h: $(srcdir)/openvrml-xembed/browser-factory.xml
+ $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
+ --mode=glib-client \
+ --output=$@ \
+ $?
+
+mozilla-plugin/browser-client-glue.h: $(srcdir)/openvrml-xembed/browser.xml
+ $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
+ --mode=glib-client \
+ --output=$@ \
+ $?
+
EXTRA_DIST = \
libopenvrml/openvrml-config.h.in \
libopenvrml-gl/openvrml-gl-config.h.in \
Property changes on: trunk/src/mozilla-plugin
___________________________________________________________________
Deleted: svn:ignore
- Makefile.in
Deleted: trunk/src/mozilla-plugin/Makefile.am
===================================================================
--- trunk/src/mozilla-plugin/Makefile.am 2009-03-24 05:01:18 UTC (rev 3865)
+++ trunk/src/mozilla-plugin/Makefile.am 2009-03-24 05:49:46 UTC (rev 3866)
@@ -1,44 +0,0 @@
-AM_CPPFLAGS = \
- -DMOZ_X11 \
- -DGTK_DISABLE_DEPRECATED \
- -DOPENVRML_LIBEXECDIR_=\"$(libexecdir)\"
-AM_CXXFLAGS = $(MOZILLA_PLUGIN_CFLAGS) $(DBUS_G_CFLAGS)
-
-mozpluginsdir = $(libdir)/mozilla/plugins
-
-if ENABLE_MOZILLA_PLUGIN
-mozplugins_LTLIBRARIES = openvrml.la
-BUILT_SOURCES = \
- browser-host-server-glue.h \
- browser-factory-client-glue.h \
- browser-client-glue.h
-endif
-
-openvrml_la_SOURCES = openvrml.cpp
-openvrml_la_LDFLAGS = \
- -module -avoid-version \
- $(MOZILLA_PLUGIN_LIBS) \
- $(DBUS_G_LIBS)
-
-browser-host-server-glue.h: $(srcdir)/../openvrml-xembed/browser-host.xml
- $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
- --prefix=openvrml_np_browser_host \
- --mode=glib-server \
- --output=$@ \
- $?
-
-browser-factory-client-glue.h: $(srcdir)/../openvrml-xembed/browser-factory.xml
- $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
- --mode=glib-client \
- --output=$@ \
- $?
-
-browser-client-glue.h: $(srcdir)/../openvrml-xembed/browser.xml
- $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
- --mode=glib-client \
- --output=$@ \
- $?
-
-EXTRA_DIST = $(openvrml_la_SOURCES)
-
-CLEANFILES = $(BUILT_SOURCES)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-24 05:01:29
|
Revision: 3865
http://openvrml.svn.sourceforge.net/openvrml/?rev=3865&view=rev
Author: braden
Date: 2009-03-24 05:01:18 +0000 (Tue, 24 Mar 2009)
Log Message:
-----------
Moved Mozilla plug-in source to src/mozilla-plugin.
Modified Paths:
--------------
trunk/ChangeLog
trunk/Makefile.am
trunk/configure.ac
trunk/src/Makefile.am
Added Paths:
-----------
trunk/src/mozilla-plugin/
trunk/src/mozilla-plugin/Makefile.am
trunk/src/mozilla-plugin/openvrml.cpp
Removed Paths:
-------------
trunk/mozilla-plugin/
trunk/src/mozilla-plugin/Makefile.am
trunk/src/mozilla-plugin/openvrml.cpp
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-24 04:40:50 UTC (rev 3864)
+++ trunk/ChangeLog 2009-03-24 05:01:18 UTC (rev 3865)
@@ -1,5 +1,20 @@
2009-03-24 Braden McDaniel <br...@en...>
+ Moved Mozilla plug-in source to src/mozilla-plugin.
+
+ * Makefile (SUBDIRS): Removed mozilla-plugin.
+ * configure.ac: Emit src/mozilla-plugin/Makefile.
+ * mozilla-plugin/Makefile.am: Removed.
+ * mozilla-plugin/src/Makefile.am: Removed.
+ * mozilla-plugin/src/openvrml.cpp: Removed.
+ * src/Makefile.am (SUBDIRS): Added mozilla-plugin.
+ * src/mozilla-plugin/Makefile.am: Moved from
+ mozilla-plugin/src/Makefile.am.
+ * src/mozilla-plugin/openvrml.cpp: Moved from
+ mozilla-plugin/src/openvrml.cpp.
+
+2009-03-24 Braden McDaniel <br...@en...>
+
Moved configuration for the Mozilla plug-in into the top-level
configure.ac.
Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am 2009-03-24 04:40:50 UTC (rev 3864)
+++ trunk/Makefile.am 2009-03-24 05:01:18 UTC (rev 3865)
@@ -1,4 +1,4 @@
-SUBDIRS = doc ide-projects models src mozilla-plugin data examples tests
+SUBDIRS = doc ide-projects models src data examples tests
ACLOCAL_AMFLAGS = -I m4
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-03-24 04:40:50 UTC (rev 3864)
+++ trunk/configure.ac 2009-03-24 05:01:18 UTC (rev 3865)
@@ -16,8 +16,7 @@
[src/script/java/vrml/Makefile]
[src/script/java/vrml/field/Makefile]
[src/script/java/vrml/node/Makefile]
- [mozilla-plugin/Makefile]
- [mozilla-plugin/src/Makefile]
+ [src/mozilla-plugin/Makefile]
[data/Makefile]
[examples/Makefile]
[tests/Makefile]
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-03-24 04:40:50 UTC (rev 3864)
+++ trunk/src/Makefile.am 2009-03-24 05:01:18 UTC (rev 3865)
@@ -1,4 +1,4 @@
-SUBDIRS = script
+SUBDIRS = script mozilla-plugin
BUILT_SOURCES =
Property changes on: trunk/src/mozilla-plugin
___________________________________________________________________
Added: svn:ignore
+ Makefile.in
Added: svn:mergeinfo
+
Deleted: trunk/src/mozilla-plugin/Makefile.am
===================================================================
--- trunk/mozilla-plugin/src/Makefile.am 2009-03-23 23:42:22 UTC (rev 3863)
+++ trunk/src/mozilla-plugin/Makefile.am 2009-03-24 05:01:18 UTC (rev 3865)
@@ -1,43 +0,0 @@
-AM_CPPFLAGS = \
- -DGTK_DISABLE_DEPRECATED \
- -DOPENVRML_LIBEXECDIR_=\"$(libexecdir)\"
-AM_CXXFLAGS = $(MOZILLA_PLUGIN_CFLAGS) $(DBUS_G_CFLAGS)
-
-mozpluginsdir = $(libdir)/mozilla/plugins
-
-if ENABLE_MOZILLA_PLUGIN
-mozplugins_LTLIBRARIES = openvrml.la
-BUILT_SOURCES = \
- browser-host-server-glue.h \
- browser-factory-client-glue.h \
- browser-client-glue.h
-endif
-
-openvrml_la_SOURCES = openvrml.cpp
-openvrml_la_LDFLAGS = \
- -module -avoid-version \
- $(MOZILLA_PLUGIN_LIBS) \
- $(DBUS_G_LIBS)
-
-browser-host-server-glue.h: $(top_srcdir)/../src/openvrml-xembed/browser-host.xml
- $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
- --prefix=openvrml_np_browser_host \
- --mode=glib-server \
- --output=$@ \
- $?
-
-browser-factory-client-glue.h: $(top_srcdir)/../src/openvrml-xembed/browser-factory.xml
- $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
- --mode=glib-client \
- --output=$@ \
- $?
-
-browser-client-glue.h: $(top_srcdir)/../src/openvrml-xembed/browser.xml
- $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
- --mode=glib-client \
- --output=$@ \
- $?
-
-EXTRA_DIST = $(openvrml_la_SOURCES)
-
-CLEANFILES = $(BUILT_SOURCES)
Copied: trunk/src/mozilla-plugin/Makefile.am (from rev 3864, trunk/mozilla-plugin/src/Makefile.am)
===================================================================
--- trunk/src/mozilla-plugin/Makefile.am (rev 0)
+++ trunk/src/mozilla-plugin/Makefile.am 2009-03-24 05:01:18 UTC (rev 3865)
@@ -0,0 +1,44 @@
+AM_CPPFLAGS = \
+ -DMOZ_X11 \
+ -DGTK_DISABLE_DEPRECATED \
+ -DOPENVRML_LIBEXECDIR_=\"$(libexecdir)\"
+AM_CXXFLAGS = $(MOZILLA_PLUGIN_CFLAGS) $(DBUS_G_CFLAGS)
+
+mozpluginsdir = $(libdir)/mozilla/plugins
+
+if ENABLE_MOZILLA_PLUGIN
+mozplugins_LTLIBRARIES = openvrml.la
+BUILT_SOURCES = \
+ browser-host-server-glue.h \
+ browser-factory-client-glue.h \
+ browser-client-glue.h
+endif
+
+openvrml_la_SOURCES = openvrml.cpp
+openvrml_la_LDFLAGS = \
+ -module -avoid-version \
+ $(MOZILLA_PLUGIN_LIBS) \
+ $(DBUS_G_LIBS)
+
+browser-host-server-glue.h: $(srcdir)/../openvrml-xembed/browser-host.xml
+ $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
+ --prefix=openvrml_np_browser_host \
+ --mode=glib-server \
+ --output=$@ \
+ $?
+
+browser-factory-client-glue.h: $(srcdir)/../openvrml-xembed/browser-factory.xml
+ $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
+ --mode=glib-client \
+ --output=$@ \
+ $?
+
+browser-client-glue.h: $(srcdir)/../openvrml-xembed/browser.xml
+ $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
+ --mode=glib-client \
+ --output=$@ \
+ $?
+
+EXTRA_DIST = $(openvrml_la_SOURCES)
+
+CLEANFILES = $(BUILT_SOURCES)
Deleted: trunk/src/mozilla-plugin/openvrml.cpp
===================================================================
--- trunk/mozilla-plugin/src/openvrml.cpp 2009-03-23 23:42:22 UTC (rev 3863)
+++ trunk/src/mozilla-plugin/openvrml.cpp 2009-03-24 05:01:18 UTC (rev 3865)
@@ -1,1307 +0,0 @@
-// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
-//
-// OpenVRML Mozilla plug-in
-//
-// Copyright 2004, 2005, 2006, 2007, 2008 Braden McDaniel
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-// more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; if not, see <http://www.gnu.org/licenses/>.
-//
-
-# include <map>
-# include <memory>
-# include <sstream>
-# include <stdexcept>
-# include <vector>
-# include <sys/socket.h>
-# include <sys/wait.h>
-# include <boost/concept_check.hpp>
-# include <boost/lexical_cast.hpp>
-# include <boost/multi_index/detail/scope_guard.hpp>
-# include <boost/noncopyable.hpp>
-# include <boost/ref.hpp>
-# include <boost/scoped_ptr.hpp>
-# include <npupp.h>
-# if defined MOZ_X11
-# include <dbus/dbus-glib-bindings.h>
-# else
-# error Unsupported toolkit.
-# endif
-
-# define OPENVRML_NP_TYPE_BROWSER_HOST (openvrml_np_browser_host_get_type())
-# define OPENVRML_NP_BROWSER_HOST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), OPENVRML_NP_TYPE_BROWSER_HOST, OpenvrmlNpBrowserHost))
-# define OPENVRML_NP_BROWSER_HOST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), OPENVRML_NP_TYPE_BROWSER_HOST, OpenvrmlNpBrowserHostClass))
-
-G_BEGIN_DECLS
-
-typedef struct OpenvrmlNpBrowserHost_ OpenvrmlNpBrowserHost;
-typedef struct OpenvrmlNpBrowserHostClass_ OpenvrmlNpBrowserHostClass;
-
-struct OpenvrmlNpBrowserHost_ {
- GObject parent;
- gchar * path;
- NPP npp;
-};
-
-struct OpenvrmlNpBrowserHostClass_ {
- GObjectClass parent;
- DBusGConnection * connection;
- gchar * host_name;
-};
-
-GType openvrml_np_browser_host_get_type();
-
-int
-openvrml_np_browser_host_get_url(OpenvrmlNpBrowserHost * host, const char * url,
- GError ** error);
-void openvrml_np_browser_host_set_world_url(OpenvrmlNpBrowserHost * host,
- const char * url, GError ** error);
-
-G_END_DECLS
-
-# include "browser-host-server-glue.h"
-# include "browser-factory-client-glue.h"
-# include "browser-client-glue.h"
-
-using namespace boost::multi_index::detail; // for scope_guard
-
-namespace {
-
- void printerr(const char * str);
-
- class plugin_instance;
-
- typedef bool (plugin_instance::*script_callback_t)(const NPVariant *,
- uint32_t,
- NPVariant *);
-
- //
- // Mozilla doesn't like us to use NPN_GetStringIdentifier during static
- // initialization; so this is a singleton.
- //
- class script_callback_map : public std::map<NPIdentifier,
- script_callback_t>,
- boost::noncopyable {
- static boost::scoped_ptr<const script_callback_map> instance_;
-
- script_callback_map();
-
- public:
- static const script_callback_map & instance();
- };
-
-
- class plugin_instance : boost::noncopyable {
- const NPP npp;
- void * window;
- int x, y;
- int width, height;
- OpenvrmlNpBrowserHost * browser_host;
- DBusGProxy * browser;
-
- public:
- NPObject * const npobj;
-
- explicit plugin_instance(NPP npp) throw (std::bad_alloc);
- ~plugin_instance() throw ();
-
- void set_window(NPWindow & window)
- throw (std::bad_alloc, std::runtime_error);
- void HandleEvent(void * event) throw ();
-
- NPError new_stream(NPMIMEType type, NPStream * stream);
- NPError destroy_stream(NPStream * stream);
- int32 write(NPStream * stream, int32 len, void * buffer);
-
- //
- // Scripting API method implementations.
- //
- bool get_name(const NPVariant * args, uint32_t argCount,
- NPVariant * result);
- bool get_version(const NPVariant * args, uint32_t argCount,
- NPVariant * result);
- };
-} // namespace
-
-G_DEFINE_TYPE(OpenvrmlNpBrowserHost, openvrml_np_browser_host, G_TYPE_OBJECT)
-
-void openvrml_np_browser_host_init(OpenvrmlNpBrowserHost * const host)
-{
- static unsigned long count = 0;
- host->path = g_strdup_printf("/org/openvrml/BrowserHost/%u/%lu",
- getpid(), count++);
- dbus_g_connection_register_g_object(
- OPENVRML_NP_BROWSER_HOST_GET_CLASS(host)->connection,
- host->path,
- G_OBJECT(host));
-}
-
-namespace {
- enum np_host_signal_id {
- shutdown_id,
- last_signal_id
- };
-
- G_GNUC_INTERNAL guint signals[last_signal_id];
-}
-
-void openvrml_np_browser_host_class_init(OpenvrmlNpBrowserHostClass * klass)
-{
- signals[shutdown_id] =
- g_signal_new("shutdown",
- G_OBJECT_CLASS_TYPE(klass),
- GSignalFlags(G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED),
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- GError * error = 0;
- scope_guard error_guard = make_guard(g_error_free, boost::ref(error));
- klass->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (!klass->connection) {
- g_critical("Failed to open connection to bus: %s", error->message);
- return;
- }
-
- klass->host_name = g_strdup_printf("org.openvrml.BrowserHost-%u",
- getpid());
-
- DBusGProxy * driver_proxy =
- dbus_g_proxy_new_for_name(klass->connection,
- DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS,
- DBUS_INTERFACE_DBUS);
- scope_guard driver_proxy_guard = make_guard(g_object_unref, driver_proxy);
- boost::ignore_unused_variable_warning(driver_proxy_guard);
-
- guint request_ret;
- if (!org_freedesktop_DBus_request_name(driver_proxy,
- klass->host_name,
- 0, &request_ret,
- &error)) {
- g_critical("Request for name \"%s\" failed: %s",
- klass->host_name, error->message);
- return;
- }
-
- dbus_g_object_type_install_info(
- OPENVRML_NP_TYPE_BROWSER_HOST,
- &dbus_glib_openvrml_np_browser_host_object_info);
- error_guard.dismiss();
-}
-
-int openvrml_np_browser_host_get_url(OpenvrmlNpBrowserHost * const host,
- const char * const url,
- GError ** /* error */)
-{
- return NPN_GetURL(host->npp, url, 0);
-}
-
-void openvrml_np_browser_host_set_world_url(OpenvrmlNpBrowserHost * /* host */,
- const char * /* url */,
- GError ** /* error */)
-{
-}
-
-char * NP_GetMIMEDescription()
-{
- return NPP_GetMIMEDescription();
-}
-
-namespace {
- NPNetscapeFuncs mozillaFuncs;
-}
-
-/**
- * @brief Provides global initialization for a plug-in.
- *
- * @param mozTable table of functions the plug-in can use to call into
- * the browser.
- * @retval pluginFuncs table of functions that the browser can use to call
- * into the plug-in.
- *
- * @return
- * - @c NPERR_INVALID_FUNCTABLE_ERROR if:
- * - @p mozTable is 0; or
- * - @p mozTable->size is smaller than expected; or
- * - @p pluginFuncs is 0; or
- * - @p pluginFuncs->size is smaller than expected.
- * - @c NPERR_INCOMPATIBLE_VERSION_ERROR if:
- * - @p mozTable->version indicates an incompatible version; or
- * - (under X) the browser does not support XEmbed; or
- * - (under X) the browser does not use Gtk2.
- * - @c NPERR_NO_ERROR otherwise.
- *
- * @see http://devedge.netscape.com/library/manuals/2002/plugin/1.0/npp_api7.html#999264
- */
-NPError NP_Initialize(NPNetscapeFuncs * const mozTable,
- NPPluginFuncs * const pluginFuncs)
-{
- if (!mozTable || !pluginFuncs) { return NPERR_INVALID_FUNCTABLE_ERROR; }
-
- //
- // Check the major version passed in Mozilla's function table. We won't
- // load if the major version is newer than what we expect. Also check that
- // the function tables passed in are big enough for all the functions we
- // need. (They could be bigger if Mozilla added new APIs; but that's okay;
- // we'll just ignore them.)
- //
- if ((mozTable->version >> 8) > NP_VERSION_MAJOR) {
- return NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
- if (mozTable->size < sizeof (NPNetscapeFuncs)
- || pluginFuncs->size < sizeof (NPPluginFuncs)) {
- return NPERR_INVALID_FUNCTABLE_ERROR;
- }
-
- //
- // Copy the fields of the Mozilla function table into our copy so we can
- // call back into Mozilla later. Note that we need to copy the fields one
- // by one rather than assign the whole struct because the Mozilla function
- // table could be bigger than what we expect.
- //
- mozillaFuncs.version = mozTable->version;
- mozillaFuncs.size = mozTable->size;
- mozillaFuncs.posturl = mozTable->posturl;
- mozillaFuncs.geturl = mozTable->geturl;
- mozillaFuncs.geturlnotify = mozTable->geturlnotify;
- mozillaFuncs.requestread = mozTable->requestread;
- mozillaFuncs.newstream = mozTable->newstream;
- mozillaFuncs.write = mozTable->write;
- mozillaFuncs.destroystream = mozTable->destroystream;
- mozillaFuncs.status = mozTable->status;
- mozillaFuncs.uagent = mozTable->uagent;
- mozillaFuncs.memalloc = mozTable->memalloc;
- mozillaFuncs.memfree = mozTable->memfree;
- mozillaFuncs.memflush = mozTable->memflush;
- mozillaFuncs.reloadplugins = mozTable->reloadplugins;
- mozillaFuncs.getJavaEnv = mozTable->getJavaEnv;
- mozillaFuncs.getJavaPeer = mozTable->getJavaPeer;
- mozillaFuncs.getvalue = mozTable->getvalue;
- mozillaFuncs.getstringidentifier = mozTable->getstringidentifier;
- mozillaFuncs.getstringidentifiers = mozTable->getstringidentifiers;
- mozillaFuncs.getintidentifier = mozTable->getintidentifier;
- mozillaFuncs.identifierisstring = mozTable->identifierisstring;
- mozillaFuncs.utf8fromidentifier = mozTable->utf8fromidentifier;
- mozillaFuncs.intfromidentifier = mozTable->intfromidentifier;
- mozillaFuncs.createobject = mozTable->createobject;
- mozillaFuncs.retainobject = mozTable->retainobject;
- mozillaFuncs.releaseobject = mozTable->releaseobject;
- mozillaFuncs.invoke = mozTable->invoke;
- mozillaFuncs.invokeDefault = mozTable->invokeDefault;
- mozillaFuncs.evaluate = mozTable->evaluate;
- mozillaFuncs.getproperty = mozTable->getproperty;
- mozillaFuncs.setproperty = mozTable->setproperty;
- mozillaFuncs.removeproperty = mozTable->removeproperty;
- mozillaFuncs.hasproperty = mozTable->hasproperty;
- mozillaFuncs.hasmethod = mozTable->hasmethod;
- mozillaFuncs.releasevariantvalue = mozTable->releasevariantvalue;
- mozillaFuncs.setexception = mozTable->setexception;
-
- //
- // Set up the plug-in function table that Mozilla will use to call us.
- // Mozilla needs to know about our version and size an have a
- // UniversalProcPointer for every function we implement.
- //
- pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
- pluginFuncs->size = sizeof (NPPluginFuncs);
- pluginFuncs->newp = NPP_New;
- pluginFuncs->destroy = NPP_Destroy;
- pluginFuncs->setwindow = NPP_SetWindow;
- pluginFuncs->newstream = NPP_NewStream;
- pluginFuncs->destroystream = NPP_DestroyStream;
- pluginFuncs->asfile = NPP_StreamAsFile;
- pluginFuncs->writeready = NPP_WriteReady;
- pluginFuncs->write = NPP_Write;
- pluginFuncs->print = NPP_Print;
- pluginFuncs->urlnotify = NPP_URLNotify;
- pluginFuncs->event = NPP_HandleEvent;
- pluginFuncs->getvalue = NPP_GetValue;
- pluginFuncs->setvalue = NPP_SetValue;
- pluginFuncs->javaClass = 0;
-
-# ifdef MOZ_X11
- NPError err = NPERR_NO_ERROR;
-
- //
- // Make sure the browser supports XEmbed plug-ins.
- //
- PRBool supportsXEmbed = PR_FALSE;
- err = CallNPN_GetValueProc(mozillaFuncs.getvalue,
- 0,
- NPNVSupportsXEmbedBool,
- &supportsXEmbed);
-
- if (err != NPERR_NO_ERROR || !supportsXEmbed) {
- return NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
-
- //
- // Make sure the browser tookit is Gtk2.
- //
- NPNToolkitType toolkit = NPNToolkitType();
- err = CallNPN_GetValueProc(mozillaFuncs.getvalue,
- 0,
- NPNVToolkit,
- &toolkit);
-
- if (err != NPERR_NO_ERROR || toolkit != NPNVGtk2) {
- return NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
-# endif // defined MOZ_X11
-
- return NPP_Initialize();
-}
-
-NPError NP_Shutdown()
-{
- NPP_Shutdown();
- return NPERR_NO_ERROR;
-}
-
-NPError NP_GetValue(void *, NPPVariable variable, void * value)
-{
- NPError err = NPERR_NO_ERROR;
- switch (variable) {
- case NPPVpluginNameString:
- *static_cast<const char **>(value) = "OpenVRML";
- break;
- case NPPVpluginDescriptionString:
- *static_cast<const char **>(value) = "VRML browser";
- break;
- default:
- err = NPERR_GENERIC_ERROR;
- }
- return err;
-}
-
-char * NPP_GetMIMEDescription()
-{
- static const char mimeDescription[] =
- "model/x3d+vrml:x3dv:X3D world;"
- "model/vrml:wrl:VRML world;"
- "x-world/x-vrml:wrl:VRML world";
- return const_cast<char *>(&mimeDescription[0]);
-}
-
-NPError NPP_Initialize()
-{
- return NPERR_NO_ERROR;
-}
-
-void NPP_Shutdown()
-{}
-
-/**
- * @internal
- *
- * @brief Create a new instance of a plug-in.
- *
- * NPP_New is called after NPP_Initialize and provides the MIME type,
- * embedded or full-screen display mode, and, for embedded plug-ins,
- * information about HTML @c EMBED arguments.
- *
- * The plug-in's NPP pointer is valid until the instance is destroyed with
- * NPP_Destroy.
- *
- * If instance data was saved from a previous instance of the plug-in by
- * the NPP_Destroy function, it is returned in the saved parameter for the
- * current instance to use.
- *
- * All attributes in the @c EMBED tag (standard and private) are passed in
- * NPP_New in the argn and argv arrays. Gecko ignores any non-standard
- * attributes within an @c EMBED tag. This gives developers a chance to use
- * private attributes to communicate instance-specific options or other
- * information to the plug-in. Place private options at the end of the list
- * of standard attributes in the @c EMBED Tag.
- *
- * @param pluginType Pointer to the MIME type for new plug-in instance.
- * @param instance Contains instance-specific private data for the plug-in
- * and Gecko. The data is stored in @p instance->pdata.
- * @param mode Display mode of the plug-in. Can be NP_EMBED or
- * NP_FULL.
- * @param argc Number of HTML arguments in the @c EMBED tag for an
- * embedded plug-in; determines the number of attributes
- * in the @p argn and @p argv arrays.
- * @param argn Array of attribute names passed to the plug-in from the
- * @c EMBED tag.
- * @param argv Array of attribute values passed to the plug-in from
- * the @c EMBED tag.
- * @param saved Pointer to data saved by NPP_Destroy for a previous
- * instance of this plug-in at the same URL. If non-null,
- * Gecko passes ownership of the NPSavedData object back
- * to the plug-in. The plug-in is responsible for freeing
- * the memory for the NPSavedData and the buffer it
- * contains.
- *
- * @see http://devedge.netscape.com/library/manuals/2002/plugin/1.0/npp_api8.html#999289
- */
-NPError NPP_New(const NPMIMEType,
- const NPP instance,
- uint16 /* mode */,
- int16 /* argc */,
- char * /* argn */[],
- char * /* argv */[],
- NPSavedData *)
-{
- if (!instance) { return NPERR_INVALID_INSTANCE_ERROR; }
-
- try {
- instance->pdata = new plugin_instance(instance);
- } catch (std::bad_alloc &) {
- return NPERR_OUT_OF_MEMORY_ERROR;
- }
- return NPERR_NO_ERROR;
-}
-
-/**
- * @internal
- *
- * @brief Release the instance data and resources associated with a plug-in.
- *
- * Gecko calls this function when a plug-in instance is deleted, typically
- * because the user has left the page containing the instance, closed the
- * window, or quit the browser. You should delete any private instance-specific
- * information stored in the plug-in's instance->pdata at this time.
- *
- * If this function is deleting the last instance of a plug-in, NPP_Shutdown
- * is subsequently called. Use NPP_Shutdown to delete any data allocated in
- * NPP_Initialize and intended to be shared by all instances of a plug-in.
- *
- * Use the optional save parameter if you want to save and reuse some state
- * or other information. Upon the user's return to the page, this information
- * is passed to the new plug-in instance when it is created with NPP_New.
- *
- * Avoid trying to save critical data with this function. Ownership of the
- * @a buf field of the NPSavedData structure passes from the plug-in to
- * Gecko when NPP_Destroy returns. The Communicator can and will discard this
- * data based on arbitrary criteria such as its size and the user's page
- * history.
- *
- * To ensure that Gecko does not crash or leak memory when the saved data is
- * discarded, NPSavedData's @a buf field should be a flat structure (a simple
- * structure with no allocated substructures) allocated with NPN_MemAlloc.
- *
- * @param instance Pointer to the plug-in instance to delete.
- * @param save State or other information to save for reuse by a new
- * instance of this plug-in at the same URL. Passed to
- * NPP_New.
- *
- * @return @c NPERR_NO_ERROR if successful; @c NPERR_INVALID_INSTANCE_ERROR if
- * @p instance is 0.
- *
- * @see http://developer.netscape.com/docs/manuals/communicator/plugin/pgfns.htm#1006838
- */
-NPError NPP_Destroy(const NPP instance, NPSavedData **)
-{
- if (!instance) { return NPERR_INVALID_INSTANCE_ERROR; }
-
- /* PLUGIN DEVELOPERS:
- * If desired, call NP_MemAlloc to create a
- * NPSavedDate structure containing any state information
- * that you want restored if this plugin instance is later
- * recreated.
- */
-
- delete static_cast<plugin_instance *>(instance->pdata);
- instance->pdata = 0;
-
- return NPERR_NO_ERROR;
-}
-
-NPError NPP_SetWindow(const NPP instance, NPWindow * const window)
-{
- if (!instance || !instance->pdata) { return NPERR_INVALID_INSTANCE_ERROR; }
- try {
- assert(window);
- static_cast<plugin_instance *>(instance->pdata)
- ->set_window(*window);
- } catch (std::bad_alloc &) {
- return NPERR_OUT_OF_MEMORY_ERROR;
- } catch (std::runtime_error & ex) {
- g_critical(ex.what());
- return NPERR_GENERIC_ERROR;
- }
- return NPERR_NO_ERROR;
-}
-
-NPError NPP_NewStream(const NPP instance,
- const NPMIMEType type,
- NPStream * const stream,
- NPBool /* seekable */,
- uint16 * const stype)
-{
- if (!instance || !instance->pdata) { return NPERR_INVALID_INSTANCE_ERROR; }
-
- *stype = NP_NORMAL;
-
- plugin_instance & pluginInstance =
- *static_cast<plugin_instance *>(instance->pdata);
-
- return pluginInstance.new_stream(type, stream);
-}
-
-NPError NPP_DestroyStream(const NPP instance,
- NPStream * const stream,
- NPError /* reason */)
-{
- if (!instance || !instance->pdata) { return NPERR_INVALID_INSTANCE_ERROR; }
-
- plugin_instance & pluginInstance =
- *static_cast<plugin_instance *>(instance->pdata);
-
- return pluginInstance.destroy_stream(stream);
-}
-
-/* PLUGIN DEVELOPERS:
- * These next 2 functions are directly relevant in a plug-in which
- * handles the data in a streaming manner. If you want zero bytes
- * because no buffer space is YET available, return 0. As long as
- * the stream has not been written to the plugin, Navigator will
- * continue trying to send bytes. If the plugin doesn't want them,
- * just return some large number from NPP_WriteReady(), and
- * ignore them in NPP_Write(). For a NP_ASFILE stream, they are
- * still called but can safely be ignored using this strategy.
- */
-
-namespace {
- int32 STREAMBUFSIZE = 0X0FFFFFFF; /* If we are reading from a file in
- * NPAsFile mode so we can take any size
- * stream in our write call (since we
- * ignore it) */
-}
-
-int32 NPP_WriteReady(NPP, NPStream *)
-{
- return STREAMBUFSIZE;
-}
-
-
-int32 NPP_Write(const NPP instance,
- NPStream * const stream,
- int32 /* offset */,
- const int32 len,
- void * const buffer)
-{
- if (!instance || !instance->pdata) { return 0; }
-
- plugin_instance & pluginInstance =
- *static_cast<plugin_instance *>(instance->pdata);
-
- return pluginInstance.write(stream, len, buffer);
-}
-
-void NPP_StreamAsFile(const NPP instance,
- NPStream *,
- const char * /* fname */)
-{
- assert(instance);
-}
-
-void NPP_Print(const NPP instance, NPPrint * const printInfo)
-{
- if (!printInfo) { return; }
-
- if (instance) {
- if (printInfo->mode == NP_FULL) {
- /*
- * PLUGIN DEVELOPERS:
- * If your plugin would like to take over
- * printing completely when it is in full-screen mode,
- * set printInfo->pluginPrinted to TRUE and print your
- * plugin as you see fit. If your plugin wants Netscape
- * to handle printing in this case, set
- * printInfo->pluginPrinted to FALSE (the default) and
- * do nothing. If you do want to handle printing
- * yourself, printOne is true if the print button
- * (as opposed to the print menu) was clicked.
- * On the Macintosh, platformPrint is a THPrint; on
- * Windows, platformPrint is a structure
- * (defined in npapi.h) containing the printer name, port,
- * etc.
- */
-
- // void * platformPrint = printInfo->print.fullPrint.platformPrint;
- // NPBool printOne = printInfo->print.fullPrint.printOne;
-
- /* Do the default*/
- // printInfo->print.fullPrint.pluginPrinted = false;
- }
- else { /* If not fullscreen, we must be embedded */
- /*
- * PLUGIN DEVELOPERS:
- * If your plugin is embedded, or is full-screen
- * but you returned false in pluginPrinted above, NPP_Print
- * will be called with mode == NP_EMBED. The NPWindow
- * in the printInfo gives the location and dimensions of
- * the embedded plugin on the printed page. On the
- * Macintosh, platformPrint is the printer port; on
- * Windows, platformPrint is the handle to the printing
- * device context.
- */
-
- // NPWindow * printWindow = &printInfo->print.embedPrint.window;
- // void * platformPrint = printInfo->print.embedPrint.platformPrint;
- }
- }
-}
-
-int16 NPP_HandleEvent(NPP, void * /* event */)
-{
- return true;
-}
-
-void NPP_URLNotify(NPP,
- const char * /* url */,
- NPReason,
- void * /* notifyData */)
-{}
-
-jref NPP_GetJavaClass()
-{
- return 0;
-}
-
-NPError NPP_GetValue(const NPP npp,
- const NPPVariable variable,
- void * const value)
-{
- if (!npp) { return NPERR_INVALID_INSTANCE_ERROR; }
-
- NPError err = NPERR_NO_ERROR;
- plugin_instance * instance = 0;
-
- switch (variable) {
- case NPPVpluginNeedsXEmbed:
- *static_cast<PRBool *>(value) = PR_TRUE;
- break;
- case NPPVpluginScriptableNPObject:
- assert(npp->pdata);
- instance = static_cast<plugin_instance *>(npp->pdata);
- NPN_RetainObject(instance->npobj);
- *static_cast<NPObject **>(value) = instance->npobj;
- break;
- default:
- err = NP_GetValue(instance, variable, value);
- }
- return err;
-}
-
-NPError NPP_SetValue(NPP, NPNVariable, void * /* value */)
-{
- return NPERR_NO_ERROR;
-}
-
-void NPN_Version(int * plugin_major,
- int * plugin_minor,
- int * mozilla_major,
- int * mozilla_minor)
-{
- *plugin_major = NP_VERSION_MAJOR;
- *plugin_minor = NP_VERSION_MINOR;
- *mozilla_major = mozillaFuncs.version >> 8;
- *mozilla_minor = mozillaFuncs.version & 0xff;
-}
-
-NPError NPN_GetURLNotify(NPP instance,
- const char * url,
- const char * target,
- void * notifyData)
-{
- const int navMinorVers = mozillaFuncs.version & 0xFF;
- return (navMinorVers >= NPVERS_HAS_NOTIFICATION)
- ? CallNPN_GetURLNotifyProc(mozillaFuncs.geturlnotify,
- instance,
- url,
- target,
- notifyData)
- : NPERR_INCOMPATIBLE_VERSION_ERROR;
-}
-
-NPError NPN_GetURL(NPP instance, const char * url, const char * target)
-{
- return CallNPN_GetURLProc(mozillaFuncs.geturl, instance, url, target);
-}
-
-NPError NPN_PostURLNotify(NPP instance,
- const char * url,
- const char * window,
- uint32 len,
- const char * buf,
- NPBool file,
- void * notifyData)
-{
- const int navMinorVers = mozillaFuncs.version & 0xFF;
- return (navMinorVers >= NPVERS_HAS_NOTIFICATION)
- ? CallNPN_PostURLNotifyProc(mozillaFuncs.posturlnotify,
- instance,
- url,
- window,
- len,
- buf,
- file,
- notifyData)
- : NPERR_INCOMPATIBLE_VERSION_ERROR;
-}
-
-NPError NPN_PostURL(NPP instance,
- const char * url,
- const char * window,
- uint32 len,
- const char * buf,
- NPBool file)
-{
- return CallNPN_PostURLProc(mozillaFuncs.posturl,
- instance,
- url,
- window,
- len,
- buf,
- file);
-}
-
-NPError NPN_RequestRead(NPStream * stream, NPByteRange * rangeList)
-{
- return CallNPN_RequestReadProc(mozillaFuncs.requestread,
- stream,
- rangeList);
-}
-
-NPError NPN_NewStream(NPP instance,
- NPMIMEType type,
- const char * target,
- NPStream ** stream)
-{
- const int navMinorVersion = mozillaFuncs.version & 0xFF;
- return (navMinorVersion >= NPVERS_HAS_STREAMOUTPUT)
- ? CallNPN_NewStreamProc(mozillaFuncs.newstream,
- instance,
- type,
- target,
- stream)
- : NPERR_INCOMPATIBLE_VERSION_ERROR;
-}
-
-int32 NPN_Write(NPP instance, NPStream * stream, int32 len, void * buffer)
-{
- const int navMinorVersion = mozillaFuncs.version & 0xFF;
- return (navMinorVersion >= NPVERS_HAS_STREAMOUTPUT)
- ? CallNPN_WriteProc(mozillaFuncs.write, instance, stream, len, buffer)
- : -1;
-}
-
-NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
-{
- const int navMinorVersion = mozillaFuncs.version & 0xFF;
- return (navMinorVersion >= NPVERS_HAS_STREAMOUTPUT)
- ? CallNPN_DestroyStreamProc(mozillaFuncs.destroystream,
- instance,
- stream,
- reason)
- : NPERR_INCOMPATIBLE_VERSION_ERROR;
-}
-
-void NPN_Status(NPP instance, const char * message)
-{
- CallNPN_StatusProc(mozillaFuncs.status, instance, message);
-}
-
-const char * NPN_UserAgent(NPP instance)
-{
- return CallNPN_UserAgentProc(mozillaFuncs.uagent, instance);
-}
-
-void * NPN_MemAlloc(uint32 size)
-{
- return CallNPN_MemAllocProc(mozillaFuncs.memalloc, size);
-}
-
-void NPN_MemFree(void * ptr)
-{
- CallNPN_MemFreeProc(mozillaFuncs.memfree, ptr);
-}
-
-uint32 NPN_MemFlush(uint32 size)
-{
- return CallNPN_MemFlushProc(mozillaFuncs.memflush, size);
-}
-
-void NPN_ReloadPlugins(NPBool reloadPages)
-{
- CallNPN_ReloadPluginsProc(mozillaFuncs.reloadplugins, reloadPages);
-}
-
-JRIEnv * NPN_GetJavaEnv()
-{
- return CallNPN_GetJavaEnvProc(mozillaFuncs.getJavaEnv);
-}
-
-jref NPN_GetJavaPeer(NPP instance)
-{
- return CallNPN_GetJavaPeerProc(mozillaFuncs.getJavaPeer, instance);
-}
-
-NPError NPN_GetValue(NPP instance, NPNVariable variable, void * value)
-{
- return CallNPN_GetValueProc(mozillaFuncs.getvalue,
- instance,
- variable,
- value);
-}
-
-NPError NPN_SetValue(NPP instance, NPPVariable variable, void * value)
-{
- return CallNPN_SetValueProc(mozillaFuncs.setvalue,
- instance,
- variable,
- value);
-}
-
-void NPN_InvalidateRect(NPP instance, NPRect * invalidRect)
-{
- CallNPN_InvalidateRectProc(mozillaFuncs.invalidaterect,
- instance,
- invalidRect);
-}
-
-void NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
-{
- CallNPN_InvalidateRegionProc(mozillaFuncs.invalidateregion,
- instance,
- invalidRegion);
-}
-
-void NPN_ForceRedraw(NPP instance)
-{
- CallNPN_ForceRedrawProc(mozillaFuncs.forceredraw, instance);
-}
-
-void NPN_ReleaseVariantValue(NPVariant * variant)
-{
- CallNPN_ReleaseVariantValueProc(mozillaFuncs.releasevariantvalue, variant);
-}
-
-NPIdentifier NPN_GetStringIdentifier(const NPUTF8 * name)
-{
- return CallNPN_GetStringIdentifierProc(mozillaFuncs.getstringidentifier,
- name);
-}
-
-void NPN_GetStringIdentifiers(const NPUTF8 ** names,
- int32_t nameCount,
- NPIdentifier * identifiers)
-{
- CallNPN_GetStringIdentifiersProc(mozillaFuncs.getstringidentifiers,
- names,
- nameCount,
- identifiers);
-}
-
-NPIdentifier NPN_GetIntIdentifier(int32_t intid)
-{
- return CallNPN_GetIntIdentifierProc(mozillaFuncs.getintidentifier, intid);
-}
-
-bool NPN_IdentifierIsString(NPIdentifier * identifier)
-{
- return CallNPN_IdentifierIsStringProc(mozillaFuncs.identifierisstring,
- identifier);
-}
-
-NPUTF8 * NPN_UTF8FromIdentifier(NPIdentifier identifier)
-{
- return CallNPN_UTF8FromIdentifierProc(mozillaFuncs.utf8fromidentifier,
- identifier);
-}
-
-int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
-{
- return CallNPN_IntFromIdentifierProc(mozillaFuncs.intfromidentifier,
- identifier);
-}
-
-NPObject * NPN_CreateObject(NPP npp, NPClass * aClass)
-{
- return CallNPN_CreateObjectProc(mozillaFuncs.createobject, npp, aClass);
-}
-
-NPObject * NPN_RetainObject(NPObject * npobj)
-{
- return CallNPN_RetainObjectProc(mozillaFuncs.retainobject, npobj);
-}
-
-void NPN_ReleaseObject(NPObject * npobj)
-{
- CallNPN_ReleaseObjectProc(mozillaFuncs.releaseobject, npobj);
-}
-
-bool NPN_Invoke(NPP npp, NPObject * npobj, NPIdentifier methodName,
- const NPVariant * args, uint32_t argCount, NPVariant * result)
-{
- return CallNPN_InvokeProc(mozillaFuncs.invoke,
- npp, npobj, methodName, args, argCount, result);
-}
-
-bool NPN_InvokeDefault(NPP npp, NPObject * npobj, const NPVariant * args,
- uint32_t argCount, NPVariant * result)
-{
- return CallNPN_InvokeDefaultProc(mozillaFuncs.invokeDefault,
- npp, npobj, args, argCount, result);
-}
-
-bool NPN_Evaluate(NPP npp, NPObject * npobj, NPString * script,
- NPVariant * result)
-{
- return CallNPN_EvaluateProc(mozillaFuncs.evaluate, npp, npobj, script,
- result);
-}
-
-bool NPN_GetProperty(NPP npp, NPObject * npobj, NPIdentifier propertyName,
- NPVariant * result)
-{
- return CallNPN_GetPropertyProc(mozillaFuncs.getproperty,
- npp, npobj, propertyName, result);
-}
-
-bool NPN_SetProperty(NPP npp, NPObject * npobj, NPIdentifier propertyName,
- const NPVariant * result)
-{
- return CallNPN_SetPropertyProc(mozillaFuncs.setproperty,
- npp, npobj, propertyName, result);
-}
-
-bool NPN_RemoveProperty(NPP npp, NPObject * npobj, NPIdentifier propertyName)
-{
- return CallNPN_RemovePropertyProc(mozillaFuncs.removeproperty,
- npp, npobj, propertyName);
-}
-
-bool NPN_HasProperty(NPP npp, NPObject * npobj, NPIdentifier propertyName)
-{
- return CallNPN_HasPropertyProc(mozillaFuncs.hasproperty,
- npp, npobj, propertyName);
-}
-
-bool NPN_HasMethod(NPP npp, NPObject * npobj, NPIdentifier methodName)
-{
- return CallNPN_HasMethodProc(mozillaFuncs.hasmethod,
- npp, npobj, methodName);
-}
-
-void NPN_SetException(NPObject * npobj, const NPUTF8 * message)
-{
- return CallNPN_SetExceptionProc(mozillaFuncs.setexception, npobj, message);
-}
-
-namespace {
-
- boost::scoped_ptr<const script_callback_map> script_callback_map::instance_;
-
- script_callback_map::script_callback_map()
- {
- using std::make_pair;
- this->insert(make_pair(NPN_GetStringIdentifier("getName"),
- &plugin_instance::get_name));
- this->insert(make_pair(NPN_GetStringIdentifier("getVersion"),
- &plugin_instance::get_version));
- }
-
- const script_callback_map & script_callback_map::instance()
- {
- if (!script_callback_map::instance_) {
- script_callback_map::instance_.reset(new script_callback_map);
- }
- return *script_callback_map::instance_;
- }
-
- void printerr(const char * str)
- {
- fprintf(stderr, "%s\n", str);
- }
-
-
- struct OpenVRMLNPObject {
- NPObject npobj;
- NPP npp;
- };
-
- NPObject * openvrmlnpobject_allocate(NPP npp, NPClass *)
- {
- OpenVRMLNPObject * const npobj =
- static_cast<OpenVRMLNPObject *>(
- NPN_MemAlloc(sizeof (OpenVRMLNPObject)));
-
- npobj->npp = npp;
-
- return static_cast<NPObject *>(static_cast<void *>(npobj));
- }
-
- void openvrmlnpobject_deallocate(NPObject * const npobj)
- {
- NPN_MemFree(npobj);
- }
-
- void openvrmlnpobject_invalidate(NPObject * /* npobj */)
- {}
-
- bool openvrmlnpobject_hasMethod(NPObject *, const NPIdentifier name)
- {
- const script_callback_map::const_iterator pos =
- script_callback_map::instance().find(name);
- return pos != script_callback_map::instance().end();
- }
-
- bool openvrmlnpobject_invoke(NPObject * const npobj,
- const NPIdentifier name,
- const NPVariant * const args,
- const uint32_t argCount,
- NPVariant * const result)
- {
- const script_callback_map::const_iterator pos =
- script_callback_map::instance().find(name);
- assert(pos != script_callback_map::instance().end());
-
- OpenVRMLNPObject * const openvrml_npobj =
- static_cast<OpenVRMLNPObject *>(static_cast<void *>(npobj));
-
- plugin_instance * const instance =
- static_cast<plugin_instance *>(openvrml_npobj->npp->pdata);
-
- return (instance->*(pos->second))(args, argCount, result);
- }
-
- bool openvrmlnpobject_invokeDefault(NPObject * /* npobj */,
- const NPVariant * /* args */,
- uint32_t /* argCount */,
- NPVariant * /* result */)
- {
- return false;
- }
-
- bool openvrmlnpobject_hasProperty(NPObject * /* npobj */,
- NPIdentifier /* name */)
- {
- return false;
- }
-
- bool openvrmlnpobject_getProperty(NPObject * /* npobj */,
- NPIdentifier /* name */,
- NPVariant * /* result */)
- {
- return false;
- }
-
- bool openvrmlnpobject_setProperty(NPObject * /* npobj */,
- NPIdentifier /* name */,
- const NPVariant * /* value */)
- {
- return false;
- }
-
- bool openvrmlnpobject_removeProperty(NPObject * /* npobj */,
- NPIdentifier /* name */)
- {
- return false;
- }
-
- NPClass npclass = {
- NP_CLASS_STRUCT_VERSION,
- openvrmlnpobject_allocate,
- openvrmlnpobject_deallocate,
- openvrmlnpobject_invalidate,
- openvrmlnpobject_hasMethod,
- openvrmlnpobject_invoke,
- openvrmlnpobject_invokeDefault,
- openvrmlnpobject_hasProperty,
- openvrmlnpobject_getProperty,
- openvrmlnpobject_setProperty,
- openvrmlnpobject_removeProperty
- };
-
- plugin_instance::plugin_instance(const NPP npp) throw (std::bad_alloc):
- npp(npp),
- window(0),
- x(0),
- y(0),
- width(0),
- height(0),
- browser_host(
- OPENVRML_NP_BROWSER_HOST(
- g_object_new(OPENVRML_NP_TYPE_BROWSER_HOST, 0))),
- browser(0),
- npobj(NPN_CreateObject(this->npp, &npclass))
- {
- if (!this->browser_host) { throw std::bad_alloc(); }
- if (!this->npobj) { throw std::bad_alloc(); }
-
- browser_host->npp = npp;
- }
-
- plugin_instance::~plugin_instance() throw ()
- {
- NPN_ReleaseObject(this->npobj);
- g_signal_emit(this->browser_host, signals[shutdown_id], 0);
- }
-
- DBusGProxy * get_browser(DBusGConnection * const connection,
- const char * const host_name,
- const char * const host_path,
- const guint64 host_id,
- GError ** const error)
- throw ()
- {
- DBusGProxy * browser_factory =
- dbus_g_proxy_new_for_name(connection,
- "org.openvrml.BrowserControl",
- "/org/openvrml/BrowserFactory",
- "org.openvrml.BrowserFactory");
- g_return_val_if_fail(browser_factory, 0);
- scope_guard browser_factory_guard =
- make_guard(g_object_unref, G_OBJECT(browser_factory));
- boost::ignore_unused_variable_warning(browser_factory_guard);
-
- char * browser_path = 0;
- if (!org_openvrml_BrowserFactory_create_control(browser_factory,
- host_name,
- host_path,
- host_id,
- true,
- &browser_path,
- error)) {
- return 0;
- }
-
- DBusGProxy * browser =
- dbus_g_proxy_new_for_name(connection,
- "org.openvrml.BrowserControl",
- browser_path,
- "org.openvrml.Browser");
- return browser;
- }
-
- void plugin_instance::set_window(NPWindow & window)
- throw (std::bad_alloc, std::runtime_error)
- {
- assert(window.window);
- if (this->window) {
- //
- // The plug-in window is unchanged. Resize the window and exit.
- //
- return;
- }
-
- using std::string;
- using std::vector;
- using boost::lexical_cast;
- using boost::ref;
-
- this->window = window.window;
-
- OpenvrmlNpBrowserHostClass * const browser_host_class =
- OPENVRML_NP_BROWSER_HOST_GET_CLASS(this->browser_host);
-
- GError * error = 0;
- scope_guard error_guard = make_guard(g_error_free, boost::ref(error));
-
- this->browser = get_browser(browser_host_class->connection,
- browser_host_class->host_name,
- this->browser_host->path,
- guint64(this->window),
- &error);
- if (!this->browser) {
- g_critical("Browser creation failed: %s", error->message);
- return;
- }
-
- error_guard.dismiss();
- }
-
- NPError plugin_instance::new_stream(const NPMIMEType type,
- NPStream * const stream)
- {
- if (!this->browser) { return NPERR_INVALID_INSTANCE_ERROR; }
-
- GError * error = 0;
- scope_guard error_guard = make_guard(g_error_free, boost::ref(error));
- gboolean result = org_openvrml_Browser_new_stream(this->browser,
- guint64(stream),
- type,
- stream->url,
- &error);
- if (!result) {
- g_critical("Call to org.openvrml.Browser.NewStream failed: %s",
- error->message);
- return NPERR_GENERIC_ERROR;
- }
- error_guard.dismiss();
- return NPERR_NO_ERROR;
- }
-
- NPError plugin_instance::destroy_stream(NPStream * const stream)
- {
- if (!this->browser) { return NPERR_INVALID_INSTANCE_ERROR; }
-
- dbus_g_proxy_call_no_reply(this->browser,
- "DestroyStream",
- G_TYPE_UINT64, guint64(stream),
- G_TYPE_INVALID);
- return NPERR_NO_ERROR;
- }
-
- int32 plugin_instance::write(NPStream * const stream,
- const int32 len,
- void * const buffer)
- {
- if (!this->browser) { return 0; }
-
- GArray array = {};
- array.data = static_cast<char *>(buffer);
- array.len = len;
-
- dbus_g_proxy_call_no_reply(this->browser,
- "Write",
- G_TYPE_UINT64, guint64(stream),
- DBUS_TYPE_G_UCHAR_ARRAY, &array,
- G_TYPE_INVALID);
- return len;
- }
-
- void plugin_instance::HandleEvent(void *) throw ()
- {}
-
- bool plugin_instance::get_name(const NPVariant * const /* args */,
- const uint32_t /* argCount */,
- NPVariant * const result)
- {
- static const std::string name = PACKAGE_NAME;
- NPUTF8 * const name_str =
- static_cast<NPUTF8 *>(
- NPN_MemAlloc(sizeof (NPUTF8) * name.length()));
- std::copy(name.begin(), name.end(), name_str);
- STRINGN_TO_NPVARIANT(name_str, name.length(), *result);
- return true;
- }
-
- bool plugin_instance::get_version(const NPVariant * const /* args */,
- const uint32_t /* argCount */,
- NPVariant * const result)
- {
- static const std::string ver = PACKAGE_VERSION;
- NPUTF8 * const ver_str =
- static_cast<NPUTF8 *>(NPN_MemAlloc(sizeof (NPUTF8) * ver.length()));
- std::copy(ver.begin(), ver.end(), ver_str);
- STRINGN_TO_NPVARIANT(ver_str, ver.length(), *result);
- return true;
- }
-} // namespace
Copied: trunk/src/mozilla-plugin/openvrml.cpp (from rev 3864, trunk/mozilla-plugin/src/openvrml.cpp)
===================================================================
--- trunk/src/mozilla-plugin/openvrml.cpp (rev 0)
+++ trunk/src/mozilla-plugin/openvrml.cpp 2009-03-24 05:01:18 UTC (rev 3865)
@@ -0,0 +1,1309 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
+//
+// OpenVRML Mozilla plug-in
+//
+// Copyright 2004, 2005, 2006, 2007, 2008 Braden McDaniel
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; if not, see <http://www.gnu.org/licenses/>.
+//
+
+# include <map>
+# include <memory>
+# include <sstream>
+# include <stdexcept>
+# include <vector>
+# include <sys/socket.h>
+# include <sys/wait.h>
+# include <boost/concept_check.hpp>
+# include <boost/lexical_cast.hpp>
+# include <boost/multi_index/detail/scope_guard.hpp>
+# include <boost/noncopyable.hpp>
+# include <boost/ref.hpp>
+# include <boost/scoped_ptr.hpp>
+# include <npupp.h>
+# if defined MOZ_X11
+# include <dbus/dbus-glib-bindings.h>
+# else
+# error Unsupported toolkit.
+# endif
+
+# include <config.h>
+
+# define OPENVRML_NP_TYPE_BROWSER_HOST (openvrml_np_browser_host_get_type())
+# define OPENVRML_NP_BROWSER_HOST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), OPENVRML_NP_TYPE_BROWSER_HOST, OpenvrmlNpBrowserHost))
+# define OPENVRML_NP_BROWSER_HOST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), OPENVRML_NP_TYPE_BROWSER_HOST, OpenvrmlNpBrowserHostClass))
+
+G_BEGIN_DECLS
+
+typedef struct OpenvrmlNpBrowserHost_ OpenvrmlNpBrowserHost;
+typedef struct OpenvrmlNpBrowserHostClass_ OpenvrmlNpBrowserHostClass;
+
+struct OpenvrmlNpBrowserHost_ {
+ GObject parent;
+ gchar * path;
+ NPP npp;
+};
+
+struct OpenvrmlNpBrowserHostClass_ {
+ GObjectClass parent;
+ DBusGConnection * connection;
+ gchar * host_name;
+};
+
+GType openvrml_np_browser_host_get_type();
+
+int
+openvrml_np_browser_host_get_url(OpenvrmlNpBrowserHost * host, const char * url,
+ GError ** error);
+void openvrml_np_browser_host_set_world_url(OpenvrmlNpBrowserHost * host,
+ const char * url, GError ** error);
+
+G_END_DECLS
+
+# include "browser-host-server-glue.h"
+# include "browser-factory-client-glue.h"
+# include "browser-client-glue.h"
+
+using namespace boost::multi_index::detail; // for scope_guard
+
+namespace {
+
+ void printerr(const char * str);
+
+ class plugin_instance;
+
+ typedef bool (plugin_instance::*script_callback_t)(const NPVariant *,
+ uint32_t,
+ NPVariant *);
+
+ //
+ // Mozilla doesn't like us to use NPN_GetStringIdentifier during static
+ // initialization; so this is a singleton.
+ //
+ class script_callback_map : public std::map<NPIdentifier,
+ script_callback_t>,
+ boost::noncopyable {
+ static boost::scoped_ptr<const script_callback_map> instance_;
+
+ script_callback_map();
+
+ public:
+ static const script_callback_map & instance();
+ };
+
+
+ class plugin_instance : boost::noncopyable {
+ const NPP npp;
+ void * window;
+ int x, y;
+ int width, height;
+ OpenvrmlNpBrowserHost * browser_host;
+ DBusGProxy * browser;
+
+ public:
+ NPObject * const npobj;
+
+ explicit plugin_instance(NPP npp) throw (std::bad_alloc);
+ ~plugin_instance() throw ();
+
+ void set_window(NPWindow & window)
+ throw (std::bad_alloc, std::runtime_error);
+ void HandleEvent(void * event) throw ();
+
+ NPError new_stream(NPMIMEType type, NPStream * stream);
+ NPError destroy_stream(NPStream * stream);
+ int32 write(NPStream * stream, int32 len, void * buffer);
+
+ //
+ // Scripting API method implementations.
+ //
+ bool get_name(const NPVariant * args, uint32_t argCount,
+ NPVariant * result);
+ bool get_version(const NPVariant * args, uint32_t argCount,
+ NPVariant * result);
+ };
+} // namespace
+
+G_DEFINE_TYPE(OpenvrmlNpBrowserHost, openvrml_np_browser_host, G_TYPE_OBJECT)
+
+void openvrml_np_browser_host_init(OpenvrmlNpBrowserHost * const host)
+{
+ static unsigned long count = 0;
+ host->path = g_strdup_printf("/org/openvrml/BrowserHost/%u/%lu",
+ getpid(), count++);
+ dbus_g_connection_register_g_object(
+ OPENVRML_NP_BROWSER_HOST_GET_CLASS(host)->connection,
+ host->path,
+ G_OBJECT(host));
+}
+
+namespace {
+ enum np_host_signal_id {
+ shutdown_id,
+ last_signal_id
+ };
+
+ G_GNUC_INTERNAL guint signals[last_signal_id];
+}
+
+void openvrml_np_browser_host_class_init(OpenvrmlNpBrowserHostClass * klass)
+{
+ signals[shutdown_id] =
+ g_signal_new("shutdown",
+ G_OBJECT_CLASS_TYPE(klass),
+ GSignalFlags(G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED),
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ GError * error = 0;
+ scope_guard error_guard = make_guard(g_error_free, boost::ref(error));
+ klass->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (!klass->connection) {
+ g_critical("Failed to open connection to bus: %s", error->message);
+ return;
+ }
+
+ klass->host_name = g_strdup_printf("org.openvrml.BrowserHost-%u",
+ getpid());
+
+ DBusGProxy * driver_proxy =
+ dbus_g_proxy_new_for_name(klass->connection,
+ DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS,
+ DBUS_INTERFACE_DBUS);
+ scope_guard driver_proxy_guard = make_guard(g_object_unref, driver_proxy);
+ boost::ignore_unused_variable_warning(driver_proxy_guard);
+
+ guint request_ret;
+ if...
[truncated message content] |
|
From: <br...@us...> - 2009-03-24 04:40:56
|
Revision: 3864
http://openvrml.svn.sourceforge.net/openvrml/?rev=3864&view=rev
Author: braden
Date: 2009-03-24 04:40:50 +0000 (Tue, 24 Mar 2009)
Log Message:
-----------
Moved configuration for the Mozilla plug-in into the top-level configure.ac.
Modified Paths:
--------------
trunk/ChangeLog
trunk/configure.ac
trunk/mozilla-plugin/Makefile.am
trunk/mozilla-plugin/src/Makefile.am
trunk/mozilla-plugin/src/openvrml.cpp
Removed Paths:
-------------
trunk/mozilla-plugin/configure.ac
Property Changed:
----------------
trunk/mozilla-plugin/
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-23 23:42:22 UTC (rev 3863)
+++ trunk/ChangeLog 2009-03-24 04:40:50 UTC (rev 3864)
@@ -1,3 +1,19 @@
+2009-03-24 Braden McDaniel <br...@en...>
+
+ Moved configuration for the Mozilla plug-in into the top-level
+ configure.ac.
+
+ * configure.ac: Added checks for Mozilla plug-in dependencies.
+ * mozilla-plugin/Makefile.am (ACLOCAL_AMFLAGS): Removed.
+ * mozilla-plugin/configure.ac: Removed.
+ * mozilla-plugin/src/Makefile.am
+ (AM_CPPFLAGS): Define MOZ_X11.
+ (browser-host-server-glue.h): Adjusted path for browser-host.xml.
+ (browser-factory-client-glue.h): Adjusted path for
+ browser-factory.xml.
+ (browser-client-glue.h): Adjusted path for browser.xml.
+ * mozilla-plugin/src/openvrml.cpp: Include <config.h>.
+
2009-03-23 Braden McDaniel <br...@en...>
Make use of pkg-config's Requires.private and Libs.private.
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-03-23 23:42:22 UTC (rev 3863)
+++ trunk/configure.ac 2009-03-24 04:40:50 UTC (rev 3864)
@@ -16,6 +16,8 @@
[src/script/java/vrml/Makefile]
[src/script/java/vrml/field/Makefile]
[src/script/java/vrml/node/Makefile]
+ [mozilla-plugin/Makefile]
+ [mozilla-plugin/src/Makefile]
[data/Makefile]
[examples/Makefile]
[tests/Makefile]
@@ -181,6 +183,16 @@
PKG_CHECK_MODULES([GNOMEUI], [libgnomeui-2.0 libgnome-2.0 >= 2.14], ,
[have_gnomeui=no])
PKG_CHECK_MODULES([CURL], [libcurl], , [have_libcurl=no])
+PKG_CHECK_MODULES([MOZILLA_PLUGIN], [xulrunner-plugin],
+ [mozilla_plugin_pkg=xulrunner-plugin],
+ [PKG_CHECK_MODULES([MOZILLA_PLUGIN], [firefox-plugin],
+ [mozilla_plugin_pkg=firefox-plugin],
+ [PKG_CHECK_MODULES([MOZILLA_PLUGIN], [seamonkey-plugin],
+ [mozilla_plugin_pkg=seamonkey-plugin],
+ [PKG_CHECK_MODULES([MOZILLA_PLUGIN], [mozilla-plugin >= 1.6],
+ [mozilla_plugin_pkg=mozilla-plugin],
+ [have_mozilla_plugin=no])])])])
+
AC_PATH_XTRA
AX_CHECK_GLU
@@ -400,7 +412,13 @@
[do not build the Mozilla plug-in])])
AS_IF([test X$enable_mozilla_plugin != Xno],
[AS_IF([test X$enable_xembed = Xno],
- [AC_MSG_FAILURE([the Mozilla plug-in cannot be built without the XEmbed control])])])
+ [AC_MSG_FAILURE([the Mozilla plug-in cannot be built without the XEmbed control])])
+ AS_IF([test "X$have_mozilla_plugin" = "Xno"],
+ [AC_MSG_FAILURE([Mozilla plug-in development headers are required to build the Mozilla plug-in.])])
+ AS_IF([test "X$have_dbus_glib" = "Xno"],
+ [AC_MSG_FAILURE([The D-Bus GLib binding is required to build the Mozilla plug-in])])])
+AM_CONDITIONAL([ENABLE_MOZILLA_PLUGIN],
+ [test "X$enable_mozilla_plugin" != "Xno" -a "X$have_dbus_glib" != "Xno"])
#
# build examples
@@ -440,8 +458,6 @@
])
AC_SUBST([OPENVRML_JAVASCRIPT_RPATH])
-AC_CONFIG_SUBDIRS([mozilla-plugin])
-
AC_CONFIG_TESTDIR([tests])
AC_OUTPUT
Property changes on: trunk/mozilla-plugin
___________________________________________________________________
Modified: svn:ignore
- Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.guess
config.sub
configure
depcomp
install-sh
ltmain.sh
missing
+ Makefile
Makefile.in
Modified: trunk/mozilla-plugin/Makefile.am
===================================================================
--- trunk/mozilla-plugin/Makefile.am 2009-03-23 23:42:22 UTC (rev 3863)
+++ trunk/mozilla-plugin/Makefile.am 2009-03-24 04:40:50 UTC (rev 3864)
@@ -1,3 +1 @@
SUBDIRS = src
-
-ACLOCAL_AMFLAGS = -I ../m4
Deleted: trunk/mozilla-plugin/configure.ac
===================================================================
--- trunk/mozilla-plugin/configure.ac 2009-03-23 23:42:22 UTC (rev 3863)
+++ trunk/mozilla-plugin/configure.ac 2009-03-24 04:40:50 UTC (rev 3864)
@@ -1,43 +0,0 @@
-AC_PREREQ([2.53])
-AC_INIT([OpenVRML Mozilla Plugin], [0.17.99],
- [ope...@li...])
-AC_COPYRIGHT([Portions copyright 2004, 2005, 2006, 2007, 2008 Braden McDaniel])
-AC_CONFIG_FILES([Makefile]
- [src/Makefile])
-AM_INIT_AUTOMAKE([1.7 foreign])
-
-AC_PROG_CXX
-
-AC_DISABLE_STATIC
-AC_ENABLE_SHARED
-enable_shared=yes
-AC_PROG_LIBTOOL
-
-ACX_PTHREAD(, [AC_MSG_FAILURE([pthread support not found])])
-
-AC_PATH_X
-if test X$no_x != Xyes; then
- AC_DEFINE([MOZ_X11], [1], [Build an X11 plug-in])
-fi
-
-PKG_CHECK_MODULES([MOZILLA_PLUGIN], [xulrunner-plugin],
- [mozilla_plugin_pkg=xulrunner-plugin],
- [PKG_CHECK_MODULES([MOZILLA_PLUGIN], [firefox-plugin],
- [mozilla_plugin_pkg=firefox-plugin],
- [PKG_CHECK_MODULES([MOZILLA_PLUGIN], [seamonkey-plugin],
- [mozilla_plugin_pkg=seamonkey-plugin],
- [PKG_CHECK_MODULES([MOZILLA_PLUGIN], [mozilla-plugin >= 1.6],
- [mozilla_plugin_pkg=mozilla-plugin],
- [have_mozilla_plugin=no])])])])
-PKG_CHECK_MODULES([DBUS_G], [dbus-glib-1], , [have_dbus_glib=no])
-AC_PATH_PROG([DBUS_BINDING_TOOL], [dbus-binding-tool])
-
-AS_IF([test "X$enable_mozilla_plugin" != "Xno"],
- [AS_IF([test "X$have_mozilla_plugin" = "Xno"],
- [AC_MSG_FAILURE([Mozilla plug-in development headers are required to build the Mozilla plug-in.])])
- AS_IF([test "X$have_dbus_glib" = "Xno"],
- [AC_MSG_FAILURE([The D-Bus GLib binding is required to build the Mozilla plug-in])])])
-AM_CONDITIONAL([ENABLE_MOZILLA_PLUGIN],
- [test "X$enable_mozilla_plugin" != "Xno" -a "X$have_dbus_glib" != "Xno"])
-
-AC_OUTPUT
Modified: trunk/mozilla-plugin/src/Makefile.am
===================================================================
--- trunk/mozilla-plugin/src/Makefile.am 2009-03-23 23:42:22 UTC (rev 3863)
+++ trunk/mozilla-plugin/src/Makefile.am 2009-03-24 04:40:50 UTC (rev 3864)
@@ -1,4 +1,5 @@
AM_CPPFLAGS = \
+ -DMOZ_X11 \
-DGTK_DISABLE_DEPRECATED \
-DOPENVRML_LIBEXECDIR_=\"$(libexecdir)\"
AM_CXXFLAGS = $(MOZILLA_PLUGIN_CFLAGS) $(DBUS_G_CFLAGS)
@@ -19,20 +20,20 @@
$(MOZILLA_PLUGIN_LIBS) \
$(DBUS_G_LIBS)
-browser-host-server-glue.h: $(top_srcdir)/../src/openvrml-xembed/browser-host.xml
+browser-host-server-glue.h: $(srcdir)/../../src/openvrml-xembed/browser-host.xml
$(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
--prefix=openvrml_np_browser_host \
--mode=glib-server \
--output=$@ \
$?
-browser-factory-client-glue.h: $(top_srcdir)/../src/openvrml-xembed/browser-factory.xml
+browser-factory-client-glue.h: $(srcdir)/../../src/openvrml-xembed/browser-factory.xml
$(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
--mode=glib-client \
--output=$@ \
$?
-browser-client-glue.h: $(top_srcdir)/../src/openvrml-xembed/browser.xml
+browser-client-glue.h: $(srcdir)/../../src/openvrml-xembed/browser.xml
$(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) \
--mode=glib-client \
--output=$@ \
Modified: trunk/mozilla-plugin/src/openvrml.cpp
===================================================================
--- trunk/mozilla-plugin/src/openvrml.cpp 2009-03-23 23:42:22 UTC (rev 3863)
+++ trunk/mozilla-plugin/src/openvrml.cpp 2009-03-24 04:40:50 UTC (rev 3864)
@@ -38,6 +38,8 @@
# error Unsupported toolkit.
# endif
+# include <config.h>
+
# define OPENVRML_NP_TYPE_BROWSER_HOST (openvrml_np_browser_host_get_type())
# define OPENVRML_NP_BROWSER_HOST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), OPENVRML_NP_TYPE_BROWSER_HOST, OpenvrmlNpBrowserHost))
# define OPENVRML_NP_BROWSER_HOST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), OPENVRML_NP_TYPE_BROWSER_HOST, OpenvrmlNpBrowserHostClass))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-23 23:42:26
|
Revision: 3863
http://openvrml.svn.sourceforge.net/openvrml/?rev=3863&view=rev
Author: braden
Date: 2009-03-23 23:42:22 +0000 (Mon, 23 Mar 2009)
Log Message:
-----------
Make use of pkg-config's Requires.private and Libs.private.
Modified Paths:
--------------
trunk/ChangeLog
trunk/openvrml-gl.pc.in
trunk/openvrml.pc.in
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-20 08:46:07 UTC (rev 3862)
+++ trunk/ChangeLog 2009-03-23 23:42:22 UTC (rev 3863)
@@ -1,3 +1,10 @@
+2009-03-23 Braden McDaniel <br...@en...>
+
+ Make use of pkg-config's Requires.private and Libs.private.
+
+ * openvrml.pc.in
+ * openvrml-gl.pc.in
+
2009-03-20 Braden McDaniel <br...@en...>
Don't need OPENVRML_PKG_REQUIRES anymore.
Modified: trunk/openvrml-gl.pc.in
===================================================================
--- trunk/openvrml-gl.pc.in 2009-03-20 08:46:07 UTC (rev 3862)
+++ trunk/openvrml-gl.pc.in 2009-03-23 23:42:22 UTC (rev 3863)
@@ -6,6 +6,7 @@
Name: @PACKAGE_NAME@-GL
Description: OpenGL renderer for OpenVRML.
Version: @PACKAGE_VERSION@
-Requires: openvrml = @PACKAGE_VERSION@
-Libs: -L${libdir} -lopenvrml-gl @GLU_LIBS@
+Requires.private: openvrml = @PACKAGE_VERSION@
+Libs: -L${libdir} -lopenvrml-gl
+Libs.private: @GLU_LIBS@
Cflags: -I${includedir} @GLU_CFLAGS@
Modified: trunk/openvrml.pc.in
===================================================================
--- trunk/openvrml.pc.in 2009-03-20 08:46:07 UTC (rev 3862)
+++ trunk/openvrml.pc.in 2009-03-23 23:42:22 UTC (rev 3863)
@@ -6,5 +6,6 @@
Name: @PACKAGE_NAME@
Description: VRML/X3D run-time library.
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lopenvrml -lboost_thread@BOOST_LIB_SUFFIX@ -lboost_filesystem@BOOST_LIB_SUFFIX@ -lltdl
+Libs: -L${libdir} -lopenvrml
+Libs.private: -lboost_thread@BOOST_LIB_SUFFIX@ -lboost_filesystem@BOOST_LIB_SUFFIX@ -lltdl
Cflags: -I${includedir}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-20 08:46:17
|
Revision: 3862
http://openvrml.svn.sourceforge.net/openvrml/?rev=3862&view=rev
Author: braden
Date: 2009-03-20 08:46:07 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Don't need OPENVRML_PKG_REQUIRES anymore.
Modified Paths:
--------------
trunk/ChangeLog
trunk/configure.ac
trunk/openvrml.pc.in
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-20 08:42:54 UTC (rev 3861)
+++ trunk/ChangeLog 2009-03-20 08:46:07 UTC (rev 3862)
@@ -1,5 +1,13 @@
2009-03-20 Braden McDaniel <br...@en...>
+ Don't need OPENVRML_PKG_REQUIRES anymore.
+
+ * configure.ac: Removed AC_SUBST for OPENVRML_PKG_REQUIRES.
+ * openvrml.pc.in: Removed Requires; we don't depend on any other
+ pkg-config-aware libraries.
+
+2009-03-20 Braden McDaniel <br...@en...>
+
* configure.ac: Now that font rendering is isolated to a dlopen'd
module, we don't need to add fontconfig and freetype2 to
OPENVRML_PKG_REQUIRES.
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-03-20 08:42:54 UTC (rev 3861)
+++ trunk/configure.ac 2009-03-20 08:46:07 UTC (rev 3862)
@@ -425,11 +425,6 @@
AM_CONDITIONAL([ENABLE_SHARED], [test "X$enable_shared" != "Xno"])
#
-# Optional dependencies (substituted in the pkg-config metadata files).
-#
-AC_SUBST([OPENVRML_PKG_REQUIRES])
-
-#
# Determine whether to apply the -rpath for the Gecko runtime libraries.
#
AS_IF([test "X$enable_gecko_rpath" = Xyes],
Modified: trunk/openvrml.pc.in
===================================================================
--- trunk/openvrml.pc.in 2009-03-20 08:42:54 UTC (rev 3861)
+++ trunk/openvrml.pc.in 2009-03-20 08:46:07 UTC (rev 3862)
@@ -6,6 +6,5 @@
Name: @PACKAGE_NAME@
Description: VRML/X3D run-time library.
Version: @PACKAGE_VERSION@
-Requires: @OPENVRML_PKG_REQUIRES@
Libs: -L${libdir} -lopenvrml -lboost_thread@BOOST_LIB_SUFFIX@ -lboost_filesystem@BOOST_LIB_SUFFIX@ -lltdl
Cflags: -I${includedir}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-20 08:42:56
|
Revision: 3861
http://openvrml.svn.sourceforge.net/openvrml/?rev=3861&view=rev
Author: braden
Date: 2009-03-20 08:42:54 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Now that font rendering is isolated to a dlopen'd module, we don't need to add fontconfig and freetype2 to OPENVRML_PKG_REQUIRES.
Modified Paths:
--------------
trunk/ChangeLog
trunk/configure.ac
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-20 08:39:34 UTC (rev 3860)
+++ trunk/ChangeLog 2009-03-20 08:42:54 UTC (rev 3861)
@@ -1,5 +1,11 @@
2009-03-20 Braden McDaniel <br...@en...>
+ * configure.ac: Now that font rendering is isolated to a dlopen'd
+ module, we don't need to add fontconfig and freetype2 to
+ OPENVRML_PKG_REQUIRES.
+
+2009-03-20 Braden McDaniel <br...@en...>
+
* configure.ac: Now that the SpiderMonkey dependency is isolated
to a dlopen'd module, we don't need to add mozilla-js to
OPENVRML_PKG_REQUIRES.
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-03-20 08:39:34 UTC (rev 3860)
+++ trunk/configure.ac 2009-03-20 08:42:54 UTC (rev 3861)
@@ -262,10 +262,6 @@
if test X$have_fontconfig = Xno -o X$have_freetype = Xno; then
AC_MSG_FAILURE([fontconfig and FreeType are required for rendering Text nodes.])
fi
- if test -n "${OPENVRML_PKG_REQUIRES}"; then
- OPENVRML_PKG_REQUIRES="${OPENVRML_PKG_REQUIRES},"
- fi
- OPENVRML_PKG_REQUIRES="${OPENVRML_PKG_REQUIRES} ${REQUIRE_FONTCONFIG} ${REQUIRE_FREETYPE}"
AC_DEFINE([OPENVRML_ENABLE_RENDER_TEXT_NODE], [1],
[Defined if support for rendering Text nodes is enabled.])
AC_DEFINE_UNQUOTED([OPENVRML_FT_CONST], [$ov_cv_ft_const],
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-20 08:39:39
|
Revision: 3860
http://openvrml.svn.sourceforge.net/openvrml/?rev=3860&view=rev
Author: braden
Date: 2009-03-20 08:39:34 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Now that the SpiderMonkey dependency is isolated to a dlopen'd module, we don't need to add mozilla-js to OPENVRML_PKG_REQUIRES.
Modified Paths:
--------------
trunk/ChangeLog
trunk/configure.ac
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-20 08:35:32 UTC (rev 3859)
+++ trunk/ChangeLog 2009-03-20 08:39:34 UTC (rev 3860)
@@ -1,5 +1,11 @@
2009-03-20 Braden McDaniel <br...@en...>
+ * configure.ac: Now that the SpiderMonkey dependency is isolated
+ to a dlopen'd module, we don't need to add mozilla-js to
+ OPENVRML_PKG_REQUIRES.
+
+2009-03-20 Braden McDaniel <br...@en...>
+
* configure.ac: Add JAVA_HOME as a precious variable.
2009-03-20 Braden McDaniel <br...@en...>
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-03-20 08:35:32 UTC (rev 3859)
+++ trunk/configure.ac 2009-03-20 08:39:34 UTC (rev 3860)
@@ -289,10 +289,6 @@
AS_IF([test -z "$JS_LIBS"], [JS_LIBS="-ljs"])])
AS_IF([test X$have_libmozjs != Xyes -a \( X$with_libjs = Xyes -a X$have_libjs != Xyes \) -o X$have_jsapi_h != Xyes],
[AC_MSG_FAILURE([SpiderMonkey is required for Script node JavaScript support.])])
-AS_IF([test X$with_libjs != Xyes],
- [AS_IF([test -n "${OPENVRML_PKG_REQUIRES}"],
- [OPENVRML_PKG_REQUIRES="${OPENVRML_PKG_REQUIRES},"])
- OPENVRML_PKG_REQUIRES="${OPENVRML_PKG_REQUIRES} ${mozilla_js_pkg}"])
AC_DEFINE([OPENVRML_ENABLE_SCRIPT_NODE_JAVASCRIPT], [1],
[Defined if Script node JavaScript support is enabled.])
#
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-20 08:35:38
|
Revision: 3859
http://openvrml.svn.sourceforge.net/openvrml/?rev=3859&view=rev
Author: braden
Date: 2009-03-20 08:35:32 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Add JAVA_HOME as a precious variable.
Modified Paths:
--------------
trunk/ChangeLog
trunk/configure.ac
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-20 08:33:25 UTC (rev 3858)
+++ trunk/ChangeLog 2009-03-20 08:35:32 UTC (rev 3859)
@@ -1,5 +1,9 @@
2009-03-20 Braden McDaniel <br...@en...>
+ * configure.ac: Add JAVA_HOME as a precious variable.
+
+2009-03-20 Braden McDaniel <br...@en...>
+
* openvrml.pc.in: Link with libboost_filesystem and libltdl.
2009-03-20 Braden McDaniel <br...@en...>
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-03-20 08:33:25 UTC (rev 3858)
+++ trunk/configure.ac 2009-03-20 08:35:32 UTC (rev 3859)
@@ -322,6 +322,7 @@
#
# Script node Java support
#
+AC_ARG_VAR([JAVA_HOME], [Path to Java Runtime Environment])
AC_ARG_ENABLE([script-node-java],
[AC_HELP_STRING([--disable-script-node-java],
[disable Script node Java support])])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-20 08:33:27
|
Revision: 3858
http://openvrml.svn.sourceforge.net/openvrml/?rev=3858&view=rev
Author: braden
Date: 2009-03-20 08:33:25 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Link with libboost_filesystem and libltdl.
Modified Paths:
--------------
trunk/ChangeLog
trunk/openvrml.pc.in
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-20 08:29:17 UTC (rev 3857)
+++ trunk/ChangeLog 2009-03-20 08:33:25 UTC (rev 3858)
@@ -1,5 +1,9 @@
-2009-03-19 Braden McDaniel <br...@en...>
+2009-03-20 Braden McDaniel <br...@en...>
+ * openvrml.pc.in: Link with libboost_filesystem and libltdl.
+
+2009-03-20 Braden McDaniel <br...@en...>
+
* openvrml.pc.in: libopenvrml no longer links with libjpeg and
libpng.
Modified: trunk/openvrml.pc.in
===================================================================
--- trunk/openvrml.pc.in 2009-03-20 08:29:17 UTC (rev 3857)
+++ trunk/openvrml.pc.in 2009-03-20 08:33:25 UTC (rev 3858)
@@ -7,5 +7,5 @@
Description: VRML/X3D run-time library.
Version: @PACKAGE_VERSION@
Requires: @OPENVRML_PKG_REQUIRES@
-Libs: -L${libdir} -lopenvrml -lboost_thread@BOOST_LIB_SUFFIX@
+Libs: -L${libdir} -lopenvrml -lboost_thread@BOOST_LIB_SUFFIX@ -lboost_filesystem@BOOST_LIB_SUFFIX@ -lltdl
Cflags: -I${includedir}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-20 08:29:28
|
Revision: 3857
http://openvrml.svn.sourceforge.net/openvrml/?rev=3857&view=rev
Author: braden
Date: 2009-03-20 08:29:17 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
libopenvrml no longer links with libjpeg and libpng.
Modified Paths:
--------------
trunk/ChangeLog
trunk/openvrml.pc.in
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-20 07:57:23 UTC (rev 3856)
+++ trunk/ChangeLog 2009-03-20 08:29:17 UTC (rev 3857)
@@ -1,5 +1,10 @@
2009-03-19 Braden McDaniel <br...@en...>
+ * openvrml.pc.in: libopenvrml no longer links with libjpeg and
+ libpng.
+
+2009-03-19 Braden McDaniel <br...@en...>
+
Moved bounded_buffer to the implementation of
openvrml_control::browser.
Modified: trunk/openvrml.pc.in
===================================================================
--- trunk/openvrml.pc.in 2009-03-20 07:57:23 UTC (rev 3856)
+++ trunk/openvrml.pc.in 2009-03-20 08:29:17 UTC (rev 3857)
@@ -7,5 +7,5 @@
Description: VRML/X3D run-time library.
Version: @PACKAGE_VERSION@
Requires: @OPENVRML_PKG_REQUIRES@
-Libs: -L${libdir} -lopenvrml @JPEG_LIBS@ @PNG_LIBS@ -lboost_thread@BOOST_LIB_SUFFIX@
+Libs: -L${libdir} -lopenvrml -lboost_thread@BOOST_LIB_SUFFIX@
Cflags: -I${includedir}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-20 07:57:33
|
Revision: 3856
http://openvrml.svn.sourceforge.net/openvrml/?rev=3856&view=rev
Author: braden
Date: 2009-03-20 07:57:23 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Link to the wiki page for building OpenVRML on Windows.
Modified Paths:
--------------
htdocs/download.html
Modified: htdocs/download.html
===================================================================
--- htdocs/download.html 2009-03-20 07:55:35 UTC (rev 3855)
+++ htdocs/download.html 2009-03-20 07:57:23 UTC (rev 3856)
@@ -28,7 +28,7 @@
<div class="body">
<h2>Source distribution</h2>
<p>The source distribution can be downloaded from <a href="http://sourceforge.net/project/showfiles.php?group_id=7151" title="OpenVRML Project Filelist">SourceForge</a>.</p>
- <p>The source distribution is a GNU-style source package that is portable to most POSIX systems with a reasonably modern C++ compiler. The source distribution also includes project files for building on Windows with the freely-available <a href="http://www.microsoft.com/express/vc/">Visual C++ Express</a> compiler.
+ <p>The source distribution is a GNU-style source package that is portable to most POSIX systems with a reasonably modern C++ compiler. The source distribution also includes project files for <a href="http://apps.sourceforge.net/trac/openvrml/wiki/BuildOpenvrmlOnWindows">building on Windows</a> with the freely-available <a href="http://www.microsoft.com/express/vc/">Visual C++ Express</a> compiler.
<h2>Binary and system-specific distributions</h2>
<h3>Fedora Linux</h3>
<p>OpenVRML is packaged for <a href="http://fedoraproject.org">Fedora</a> and can be installed using <tt>yum</tt>; e.g.:</p>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-20 07:55:44
|
Revision: 3855
http://openvrml.svn.sourceforge.net/openvrml/?rev=3855&view=rev
Author: braden
Date: 2009-03-20 07:55:35 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Internet Explorer doesn't like mixing <button> with <a>.
Modified Paths:
--------------
htdocs/index.php
Modified: htdocs/index.php
===================================================================
--- htdocs/index.php 2009-03-20 07:38:38 UTC (rev 3854)
+++ htdocs/index.php 2009-03-20 07:55:35 UTC (rev 3855)
@@ -178,23 +178,27 @@
padding: 1.5em;
margin-bottom: 1.5em;
}
-.download button {
+.download .button {
display: block;
font-size: larger;
font-weight: bold;
color: white;
border-color: rgb(45%, 90%, 45%);
-/* border-color: rgb(60, 90, 60); */
background-color: rgb(0%, 75%, 0%);
padding: 0.5em;
-moz-border-radius: 0.5em;
margin-left: auto;
margin-right: auto;
+ border-style: outset;
+ border-width: 3px;
}
-.download button:hover {
+.download .button:hover {
border-color: rgb(50%, 100%, 50%);
background-color: rgb(0%, 80%, 0%);
}
+.download .button:active {
+ border-style: inset;
+}
.download p {
margin-bottom: 0;
}
@@ -269,7 +273,7 @@
<tr>
<td class="projinfo" valign="top">
<div class="download">
- <a href="http://sourceforge.net/project/platformdownload.php?group_id=7151"><button>Download Source</button></a>
+ <a class="button" href="http://sourceforge.net/project/platformdownload.php?group_id=7151">Download Source</a>
<p><em><a rel="next" href="download">Other download options…</a></em></p>
</div>
<div class="projsummary">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-20 07:38:54
|
Revision: 3854
http://openvrml.svn.sourceforge.net/openvrml/?rev=3854&view=rev
Author: braden
Date: 2009-03-20 07:38:38 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Style tweaks for Internet Explorer.
Modified Paths:
--------------
htdocs/index.php
htdocs/openvrml.css
Modified: htdocs/index.php
===================================================================
--- htdocs/index.php 2009-03-20 06:26:13 UTC (rev 3853)
+++ htdocs/index.php 2009-03-20 07:38:38 UTC (rev 3854)
@@ -238,7 +238,7 @@
}
.projsummary :link, .projsummary :visited {
display: block;
- color: inherit;
+ color: white;
border-style: none;
padding-top: 0.5em;
padding-bottom: 0.5em;
@@ -246,9 +246,6 @@
.projsummary :link:hover, .projsummary :visited:hover {
background-color: #b6c4d1;
}
-.sflogo {
- float: right;
-}
</style>
</head>
<body>
Modified: htdocs/openvrml.css
===================================================================
--- htdocs/openvrml.css 2009-03-20 06:26:13 UTC (rev 3853)
+++ htdocs/openvrml.css 2009-03-20 07:38:38 UTC (rev 3854)
@@ -53,6 +53,7 @@
}
hr {
+ color: red;
background-color: red;
height: 3px;
border-color: red;
@@ -150,4 +151,5 @@
.footer :link:hover img, .footer :visited:hover img {
padding: 1px;
border-style: solid;
+ border-color: white;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-20 06:26:35
|
Revision: 3853
http://openvrml.svn.sourceforge.net/openvrml/?rev=3853&view=rev
Author: braden
Date: 2009-03-20 06:26:13 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Comment line for Emacs buffer local variables seems to throw Internet Explorer into quirks mode.
Modified Paths:
--------------
htdocs/index.php
Modified: htdocs/index.php
===================================================================
--- htdocs/index.php 2009-03-20 06:05:04 UTC (rev 3852)
+++ htdocs/index.php 2009-03-20 06:26:13 UTC (rev 3853)
@@ -1,4 +1,3 @@
-<!-- -*- indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-20 06:05:15
|
Revision: 3852
http://openvrml.svn.sourceforge.net/openvrml/?rev=3852&view=rev
Author: braden
Date: 2009-03-20 06:05:04 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Use & in URLs.
Modified Paths:
--------------
htdocs/index.php
Modified: htdocs/index.php
===================================================================
--- htdocs/index.php 2009-03-19 06:38:39 UTC (rev 3851)
+++ htdocs/index.php 2009-03-20 06:05:04 UTC (rev 3852)
@@ -169,7 +169,7 @@
<link rev="meta" href="http://directory.fsf.org/project/openvrml/" title="FSF Directory project page">
<link rev="meta" href="http://advogato.org/proj/OpenVRML/" title="Advogato project page">
<link rev="meta" href="http://cia.vc/stats/project/openvrml" title="CIA.vc project page">
- <link rel="alternate" type="application/rss+xml" href="http://sourceforge.net/export/rss2_projnews.php?group_id=7151&rss_fulltext=1" title="OpenVRML Project News">
+ <link rel="alternate" type="application/rss+xml" href="http://sourceforge.net/export/rss2_projnews.php?group_id=7151&rss_fulltext=1" title="OpenVRML Project News">
<link rel="alternate" type="application/rss+xml" href="http://sourceforge.net/export/rss2_projsummary.php?group_id=7151" title="OpenVRML Project Summary">
<style type="text/css" media="nn4dummy, screen">
.download {
@@ -315,7 +315,7 @@
</tbody>
</table>
</div>
- <address class="footer"><span class="images"><a href="http://web3d.org/x3d/"><img src="x3d-white-on-black" width="43" height="32" border="0" alt="X3D"></a><a href="http://opengl.org"><img src="OGL_sm_wht" width="68" height="32" border="0" alt="OpenGL"></a><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=7151&type=3" width="125" height="37" border="0" alt="SourceForge.net"></a></span><a href="mailto:br...@us...">Contact Webmaster</a></address>
+ <address class="footer"><span class="images"><a href="http://web3d.org/x3d/"><img src="x3d-white-on-black" width="43" height="32" border="0" alt="X3D"></a><a href="http://opengl.org"><img src="OGL_sm_wht" width="68" height="32" border="0" alt="OpenGL"></a><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=7151&type=3" width="125" height="37" border="0" alt="SourceForge.net"></a></span><a href="mailto:br...@us...">Contact Webmaster</a></address>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">_uacct = "UA-446379-2"; urchinTracker();</script>
</body>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-19 06:38:55
|
Revision: 3851
http://openvrml.svn.sourceforge.net/openvrml/?rev=3851&view=rev
Author: braden
Date: 2009-03-19 06:38:39 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Moved bounded_buffer to the implementation of openvrml_control::browser.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/libopenvrml-control/openvrml_control/browser.cpp
Removed Paths:
-------------
trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-19 06:30:11 UTC (rev 3850)
+++ trunk/ChangeLog 2009-03-19 06:38:39 UTC (rev 3851)
@@ -1,5 +1,21 @@
2009-03-19 Braden McDaniel <br...@en...>
+ Moved bounded_buffer to the implementation of
+ openvrml_control::browser.
+
+ * src/Makefile.am
+ (libopenvrml_control_libopenvrml_control_la_SOURCES): Removed
+ reference to
+ libopenvrml-control/openvrml_control/bounded_buffer.h.
+ * src/libopenvrml-control/openvrml_control/bounded_buffer.h:
+ Removed.
+ * src/libopenvrml-control/openvrml_control/browser.cpp: Moved
+ bounded_buffer from
+ src/libopenvrml-control/openvrml_control/bounded_buffer.h to an
+ unnamed namespace here.
+
+2009-03-19 Braden McDaniel <br...@en...>
+
Moved plugin_streambuf, uninitialized_plugin_streambuf_map, and
plugin_streambuf_map to be private member classes of
openvrml_control::browser.
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-03-19 06:30:11 UTC (rev 3850)
+++ trunk/src/Makefile.am 2009-03-19 06:38:39 UTC (rev 3851)
@@ -730,8 +730,7 @@
endif
libopenvrml_control_libopenvrml_control_la_SOURCES = \
libopenvrml-control/openvrml_control/browser.cpp \
- libopenvrml-control/openvrml_control/browser.h \
- libopenvrml-control/openvrml_control/bounded_buffer.h
+ libopenvrml-control/openvrml_control/browser.h
libopenvrml_control_libopenvrml_control_la_CPPFLAGS = \
-I$(top_builddir)/src/libopenvrml \
-I$(top_srcdir)/src/libopenvrml
Deleted: trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h 2009-03-19 06:30:11 UTC (rev 3850)
+++ trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h 2009-03-19 06:38:39 UTC (rev 3851)
@@ -1,116 +0,0 @@
-// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
-//
-// OpenVRML Control
-//
-// Copyright 2004, 2005, 2006, 2007 Braden McDaniel
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-// more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; if not, see <http://www.gnu.org/licenses/>.
-//
-
-# ifndef OPENVRML_CONTROL_BOUNDED_BUFFER_H
-# define OPENVRML_CONTROL_BOUNDED_BUFFER_H
-
-# include <cassert>
-# include <string>
-# include <boost/thread/mutex.hpp>
-# include <boost/thread/condition.hpp>
-
-namespace openvrml_control {
-
- template <typename CharT, size_t BufferSize>
- class bounded_buffer {
- mutable boost::mutex mutex_;
- boost::condition buffer_not_full_, buffer_not_empty_or_eof_;
-
- CharT buf_[BufferSize];
- size_t begin_, end_, buffered_;
- bool eof_;
-
- public:
- typedef CharT char_type;
- typedef typename std::char_traits<char_type> traits_type;
- typedef typename traits_type::int_type int_type;
-
- bounded_buffer();
- void put(const char_type & c);
- int_type get();
- size_t buffered() const;
- void set_eof();
- bool eof() const;
- };
-
- template <typename CharT, size_t BufferSize>
- bounded_buffer<CharT, BufferSize>::bounded_buffer():
- begin_(0),
- end_(0),
- buffered_(0),
- eof_(false)
- {}
-
- template <typename CharT, size_t BufferSize>
- void bounded_buffer<CharT, BufferSize>::put(const char_type & c)
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->buffered_ == BufferSize) {
- this->buffer_not_full_.wait(lock);
- }
- this->buf_[this->end_] = c;
- this->end_ = (this->end_ + 1) % BufferSize;
- ++this->buffered_;
- this->buffer_not_empty_or_eof_.notify_one();
- }
-
- template <typename CharT, size_t BufferSize>
- typename bounded_buffer<CharT, BufferSize>::int_type
- bounded_buffer<CharT, BufferSize>::get()
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->buffered_ == 0 && !this->eof_) {
- this->buffer_not_empty_or_eof_.wait(lock);
- }
- if (this->buffered_ == 0 && this->eof_) {
- return traits_type::eof();
- }
- const int_type c = traits_type::to_int_type(this->buf_[this->begin_]);
- this->begin_ = (this->begin_ + 1) % BufferSize;
- --this->buffered_;
- this->buffer_not_full_.notify_one();
- assert(!traits_type::eq_int_type(c, traits_type::eof()));
- return c;
- }
-
- template <typename CharT, size_t BufferSize>
- size_t bounded_buffer<CharT, BufferSize>::buffered() const
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- return this->buffered_;
- }
-
- template <typename CharT, size_t BufferSize>
- void bounded_buffer<CharT, BufferSize>::set_eof()
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- this->eof_ = true;
- this->buffer_not_empty_or_eof_.notify_one();
- }
-
- template <typename CharT, size_t BufferSize>
- bool bounded_buffer<CharT, BufferSize>::eof() const
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- return this->eof_;
- }
-}
-
-# endif // ifndef OPENVRML_CONTROL_BOUNDED_BUFFER_H
Modified: trunk/src/libopenvrml-control/openvrml_control/browser.cpp
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/browser.cpp 2009-03-19 06:30:11 UTC (rev 3850)
+++ trunk/src/libopenvrml-control/openvrml_control/browser.cpp 2009-03-19 06:38:39 UTC (rev 3851)
@@ -19,7 +19,6 @@
//
# include "browser.h"
-# include "bounded_buffer.h"
# include <boost/enable_shared_from_this.hpp>
# include <boost/lexical_cast.hpp>
# include <iostream>
@@ -79,6 +78,93 @@
// plugin_streambuf is removed, the plugin_streambuf is deleted.
//
+namespace {
+
+ template <typename CharT, size_t BufferSize>
+ class bounded_buffer {
+ mutable boost::mutex mutex_;
+ boost::condition buffer_not_full_, buffer_not_empty_or_eof_;
+
+ CharT buf_[BufferSize];
+ size_t begin_, end_, buffered_;
+ bool eof_;
+
+ public:
+ typedef CharT char_type;
+ typedef typename std::char_traits<char_type> traits_type;
+ typedef typename traits_type::int_type int_type;
+
+ bounded_buffer();
+ void put(const char_type & c);
+ int_type get();
+ size_t buffered() const;
+ void set_eof();
+ bool eof() const;
+ };
+
+ template <typename CharT, size_t BufferSize>
+ bounded_buffer<CharT, BufferSize>::bounded_buffer():
+ begin_(0),
+ end_(0),
+ buffered_(0),
+ eof_(false)
+ {}
+
+ template <typename CharT, size_t BufferSize>
+ void bounded_buffer<CharT, BufferSize>::put(const char_type & c)
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->buffered_ == BufferSize) {
+ this->buffer_not_full_.wait(lock);
+ }
+ this->buf_[this->end_] = c;
+ this->end_ = (this->end_ + 1) % BufferSize;
+ ++this->buffered_;
+ this->buffer_not_empty_or_eof_.notify_one();
+ }
+
+ template <typename CharT, size_t BufferSize>
+ typename bounded_buffer<CharT, BufferSize>::int_type
+ bounded_buffer<CharT, BufferSize>::get()
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->buffered_ == 0 && !this->eof_) {
+ this->buffer_not_empty_or_eof_.wait(lock);
+ }
+ if (this->buffered_ == 0 && this->eof_) {
+ return traits_type::eof();
+ }
+ const int_type c = traits_type::to_int_type(this->buf_[this->begin_]);
+ this->begin_ = (this->begin_ + 1) % BufferSize;
+ --this->buffered_;
+ this->buffer_not_full_.notify_one();
+ assert(!traits_type::eq_int_type(c, traits_type::eof()));
+ return c;
+ }
+
+ template <typename CharT, size_t BufferSize>
+ size_t bounded_buffer<CharT, BufferSize>::buffered() const
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ return this->buffered_;
+ }
+
+ template <typename CharT, size_t BufferSize>
+ void bounded_buffer<CharT, BufferSize>::set_eof()
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ this->eof_ = true;
+ this->buffer_not_empty_or_eof_.notify_one();
+ }
+
+ template <typename CharT, size_t BufferSize>
+ bool bounded_buffer<CharT, BufferSize>::eof() const
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ return this->eof_;
+ }
+}
+
class OPENVRML_LOCAL openvrml_control::browser::plugin_streambuf :
public boost::enable_shared_from_this<
openvrml_control::browser::plugin_streambuf>,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-19 06:30:23
|
Revision: 3850
http://openvrml.svn.sourceforge.net/openvrml/?rev=3850&view=rev
Author: braden
Date: 2009-03-19 06:30:11 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Moved plugin_streambuf, uninitialized_plugin_streambuf_map, and plugin_streambuf_map to be private member classes of openvrml_control::browser.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/libopenvrml-control/openvrml_control/browser.cpp
trunk/src/libopenvrml-control/openvrml_control/browser.h
Removed Paths:
-------------
trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.cpp
trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-19 05:46:08 UTC (rev 3849)
+++ trunk/ChangeLog 2009-03-19 06:30:11 UTC (rev 3850)
@@ -1,5 +1,28 @@
2009-03-19 Braden McDaniel <br...@en...>
+ Moved plugin_streambuf, uninitialized_plugin_streambuf_map, and
+ plugin_streambuf_map to be private member classes of
+ openvrml_control::browser.
+
+ * src/Makefile.am
+ (libopenvrml_control_libopenvrml_control_la_SOURCES): Removed
+ libopenvrml-control/openvrml_control/plugin_streambuf.{cpp,h}.
+ * src/libopenvrml-control/openvrml_control/browser.cpp: Added
+ definition of openvrml_control::browser::plugin_streambuf as well
+ as member definitions for it and
+ openvrml_control::browser::uninitialized_plugin_streambuf_map and
+ openvrml_control::browser::plugin_streambuf_map.
+ * src/libopenvrml-control/openvrml_control/browser.h
+ (openvrml_control::browser): Added declaration plugin_streambuf;
+ added definitions of uninitialized_plugin_streambuf_map and
+ plugin_streambuf_map.
+ * src/libopenvrml-control/openvrml_control/plugin_streambuf.cpp:
+ Removed.
+ * src/libopenvrml-control/openvrml_control/plugin_streambuf.h:
+ Removed.
+
+2009-03-19 Braden McDaniel <br...@en...>
+
* src/libopenvrml-control/openvrml_control/browser.cpp
(openvrml_control::browser_host::get_url(const std::string &)):
Added missing return statement.
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-03-19 05:46:08 UTC (rev 3849)
+++ trunk/src/Makefile.am 2009-03-19 06:30:11 UTC (rev 3850)
@@ -731,8 +731,6 @@
libopenvrml_control_libopenvrml_control_la_SOURCES = \
libopenvrml-control/openvrml_control/browser.cpp \
libopenvrml-control/openvrml_control/browser.h \
- libopenvrml-control/openvrml_control/plugin_streambuf.cpp \
- libopenvrml-control/openvrml_control/plugin_streambuf.h \
libopenvrml-control/openvrml_control/bounded_buffer.h
libopenvrml_control_libopenvrml_control_la_CPPFLAGS = \
-I$(top_builddir)/src/libopenvrml \
Modified: trunk/src/libopenvrml-control/openvrml_control/browser.cpp
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/browser.cpp 2009-03-19 05:46:08 UTC (rev 3849)
+++ trunk/src/libopenvrml-control/openvrml_control/browser.cpp 2009-03-19 06:30:11 UTC (rev 3850)
@@ -19,7 +19,8 @@
//
# include "browser.h"
-# include <openvrml/browser.h>
+# include "bounded_buffer.h"
+# include <boost/enable_shared_from_this.hpp>
# include <boost/lexical_cast.hpp>
# include <iostream>
@@ -35,6 +36,344 @@
openvrml_control::unknown_stream::~unknown_stream() throw ()
{}
+//
+// plugin_streambuf Life Cycle
+//
+// A plugin_streambuf is first created in
+// browser::resource_fetcher::do_get_resource (which is called whenever
+// libopenvrml needs to load a stream).
+//
+// Step 1: Requested plugin_streambuf
+//
+// Upon creation, the plugin_streambuf is inserted into the
+// unintialized_plugin_streambuf_map with an initial plugin_streambuf::state
+// of requested. do_get_resource does not complete until the result of asking
+// the host application to resolve the URL is known; i.e.,
+// plugin_streambuf::get_url_result. get_url_result blocks until the response
+// is received from the host application; i.e., until
+// plugin_streambuf::set_get_url_result has been called.
+//
+// Step 2: Uninitialized plugin_streambuf
+//
+// If plugin_streambuf::set_get_url_result is given a result code indicating
+// success (i.e., 0), the plugin_streambuf::state is changed to uninitialized
+// (otherwise, the stream is removed from the
+// uninitialized_plugin_streambuf_map and we're done). When
+// browser::new_stream is called, a plugin_streambuf matching that URL is
+// gotten from the uninitialized_plugin_streambuf_map and
+// plugin_streambuf::init is called on it. init removes the plugin_streambuf
+// from the uninitialized_plugin_streambuf_map_ and inserts it in the
+// plugin_streambuf_map with a plugin_streambuf::state of initialized.
+//
+// Step 3: Initialized plugin_streambuf (plugin_streambuf_map)
+//
+// The plugin_streambuf_map comprises plugin_streambufs that are being written
+// to in response to browser::write calls and read from by stream readers in
+// libopenvrml. Once the host is done calling browser::write for a stream, it
+// is expected that it will call browser::destroy_stream. In response to this
+// call, bounded_buffer<>::set_eof is called on the plugin_streambuf's
+// underlying bounded_buffer<> and the plugin_streambuf is removed from the
+// plugin_streambuf_map.
+//
+// Once the last reference to the resource_istream corresponding to the
+// plugin_streambuf is removed, the plugin_streambuf is deleted.
+//
+
+class OPENVRML_LOCAL openvrml_control::browser::plugin_streambuf :
+ public boost::enable_shared_from_this<
+ openvrml_control::browser::plugin_streambuf>,
+ public std::streambuf {
+
+ friend class openvrml_control::browser;
+
+public:
+ enum state_id {
+ requested,
+ uninitialized,
+ initialized
+ };
+
+private:
+ state_id state_;
+ mutable boost::mutex mutex_;
+ int get_url_result_;
+ mutable boost::condition received_get_url_result_;
+ mutable boost::condition streambuf_initialized_or_failed_;
+ std::string url_;
+ std::string type_;
+ bounded_buffer<char_type, 16384> buf_;
+ int_type i_;
+ char_type c_;
+ uninitialized_plugin_streambuf_map & uninitialized_map_;
+ plugin_streambuf_map & map_;
+
+protected:
+ virtual int_type underflow();
+
+public:
+ plugin_streambuf(const std::string & requested_url,
+ uninitialized_plugin_streambuf_map & uninitialized_map,
+ plugin_streambuf_map & map);
+ state_id state() const;
+ void set_get_url_result(int result);
+ void init(size_t stream_id,
+ const std::string & received_url,
+ const std::string & type);
+ void fail();
+ const std::string & url() const;
+ const std::string & type() const;
+ bool data_available() const;
+};
+
+openvrml_control::browser::plugin_streambuf::
+plugin_streambuf(const std::string & requested_url,
+ uninitialized_plugin_streambuf_map & uninitialized_map,
+ plugin_streambuf_map & map):
+ state_(requested),
+ get_url_result_(-1),
+ url_(requested_url),
+ i_(0),
+ c_('\0'),
+ uninitialized_map_(uninitialized_map),
+ map_(map)
+{
+ //
+ // This is really just here to emphasize that c_ must not be EOF.
+ //
+ this->i_ = traits_type::not_eof(this->i_);
+ this->c_ =
+ traits_type::to_char_type(
+ traits_type::not_eof(traits_type::to_int_type(this->c_)));
+
+ this->setg(&this->c_, &this->c_, &this->c_);
+}
+
+openvrml_control::browser::plugin_streambuf::state_id
+openvrml_control::browser::plugin_streambuf::state() const
+{
+ boost::mutex::scoped_lock lock(this->mutex_);
+ return this->state_;
+}
+
+void
+openvrml_control::browser::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;
+
+ //
+ // If result is nonzero, the resource fetch failed early (i.e., before
+ // actually getting the stream. In that case, nothing else should be
+ // playing with this. Removing this streambuf from uninitialized_map_
+ // below may (and probably will) result in destruction of this instance.
+ //
+ // So, anyone waiting on received_get_url_result_ should be doing so
+ // because the fetching code is trying to do something with this streambuf
+ // because the fetch is in-progress (i.e., succeeding). If you're waiting
+ // on this condition and result could possibly indicate failure, you're
+ // doing it wrong.
+ //
+ if (result == 0) {
+ this->state_ = plugin_streambuf::uninitialized;
+ this->received_get_url_result_.notify_all();
+ } else {
+ this->uninitialized_map_.erase(*this);
+ }
+}
+
+void
+openvrml_control::browser::plugin_streambuf::
+init(const size_t stream_id,
+ const std::string & received_url,
+ const std::string & type)
+{
+ assert(stream_id);
+ assert(!received_url.empty());
+ assert(!type.empty());
+
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->state_ != plugin_streambuf::uninitialized) {
+ this->received_get_url_result_.wait(lock);
+ }
+
+ assert(this->state_ == uninitialized);
+
+ bool succeeded = this->uninitialized_map_.erase(*this);
+ assert(succeeded);
+ this->url_ = received_url;
+ this->type_ = type;
+ this->state_ = plugin_streambuf::initialized;
+ const boost::shared_ptr<plugin_streambuf> this_ = shared_from_this();
+ succeeded = this->map_.insert(stream_id, this_);
+ assert(succeeded);
+ this->streambuf_initialized_or_failed_.notify_all();
+}
+
+void openvrml_control::browser::plugin_streambuf::fail()
+{
+ boost::mutex::scoped_lock lock(this->mutex_);
+ const bool succeeded = this->uninitialized_map_.erase(*this);
+ assert(succeeded);
+ this->buf_.set_eof();
+ this->streambuf_initialized_or_failed_.notify_all();
+}
+
+const std::string & openvrml_control::browser::plugin_streambuf::url() const
+{
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->state_ != plugin_streambuf::initialized) {
+ this->streambuf_initialized_or_failed_.wait(lock);
+ }
+ return this->url_;
+}
+
+const std::string & openvrml_control::browser::plugin_streambuf::type() const
+{
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->state_ != plugin_streambuf::initialized) {
+ this->streambuf_initialized_or_failed_.wait(lock);
+ }
+ return this->type_;
+}
+
+bool openvrml_control::browser::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_.eof();
+}
+
+openvrml_control::browser::plugin_streambuf::int_type
+openvrml_control::browser::plugin_streambuf::underflow()
+{
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->state_ != plugin_streambuf::initialized) {
+ this->streambuf_initialized_or_failed_.wait(lock);
+ }
+
+ if (traits_type::eq_int_type(this->i_, traits_type::eof())) {
+ return traits_type::eof();
+ }
+
+ this->i_ = this->buf_.get();
+ this->c_ = traits_type::to_char_type(this->i_);
+
+ if (traits_type::eq_int_type(this->i_, traits_type::eof())) {
+ return traits_type::eof();
+ }
+
+ this->setg(&this->c_, &this->c_, &this->c_ + 1);
+ return traits_type::to_int_type(*this->gptr());
+}
+
+const boost::shared_ptr<openvrml_control::browser::plugin_streambuf>
+openvrml_control::browser::uninitialized_plugin_streambuf_map::
+find(const std::string & url) const
+{
+ openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
+ map_t::const_iterator pos = this->map_.find(url);
+ return pos == this->map_.end()
+ ? boost::shared_ptr<plugin_streambuf>()
+ : pos->second;
+}
+
+void
+openvrml_control::browser::uninitialized_plugin_streambuf_map::
+insert(const std::string & url,
+ const boost::shared_ptr<plugin_streambuf> & streambuf)
+{
+ openvrml::read_write_mutex::scoped_write_lock lock(this->mutex_);
+ this->map_.insert(make_pair(url, streambuf));
+}
+
+struct openvrml_control::browser::uninitialized_plugin_streambuf_map::map_entry_matches_streambuf :
+ std::unary_function<bool, map_t::value_type> {
+
+ explicit map_entry_matches_streambuf(const plugin_streambuf * streambuf):
+ streambuf_(streambuf)
+ {}
+
+ bool operator()(const map_t::value_type & entry) const
+ {
+ return this->streambuf_ == entry.second.get();
+ }
+
+private:
+ const plugin_streambuf * const streambuf_;
+};
+
+bool
+openvrml_control::browser::uninitialized_plugin_streambuf_map::
+erase(const plugin_streambuf & streambuf)
+{
+ openvrml::read_write_mutex::scoped_read_write_lock lock(this->mutex_);
+ const map_t::iterator pos =
+ std::find_if(this->map_.begin(), this->map_.end(),
+ map_entry_matches_streambuf(&streambuf));
+ if (pos == this->map_.end()) { return false; }
+ lock.promote();
+ this->map_.erase(pos);
+ return true;
+}
+
+size_t
+openvrml_control::browser::uninitialized_plugin_streambuf_map::size() const
+{
+ openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
+ return this->map_.size();
+}
+
+bool
+openvrml_control::browser::uninitialized_plugin_streambuf_map::empty() const
+{
+ openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
+ return this->map_.empty();
+}
+
+const boost::shared_ptr<openvrml_control::browser::plugin_streambuf>
+openvrml_control::browser::uninitialized_plugin_streambuf_map::front() const
+{
+ openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
+ assert(!this->map_.empty());
+ return this->map_.begin()->second;
+}
+
+
+const boost::shared_ptr<openvrml_control::browser::plugin_streambuf>
+openvrml_control::browser::plugin_streambuf_map::find(const size_t id) const
+{
+ openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
+ map_t::const_iterator pos = this->map_.find(id);
+ return pos == this->map_.end()
+ ? boost::shared_ptr<plugin_streambuf>()
+ : pos->second;
+}
+
+bool
+openvrml_control::browser::plugin_streambuf_map::
+insert(const size_t id,
+ const boost::shared_ptr<plugin_streambuf> & streambuf)
+{
+ openvrml::read_write_mutex::scoped_write_lock lock(this->mutex_);
+ return this->map_.insert(make_pair(id, streambuf)).second;
+}
+
+/**
+ * @brief Erase the entry corresponding to @p id.
+ *
+ * @return @c true if an entry was removed; @c false otherwise.
+ */
+bool openvrml_control::browser::plugin_streambuf_map::erase(const size_t id)
+{
+ openvrml::read_write_mutex::scoped_write_lock lock(this->mutex_);
+ return this->map_.erase(id) > 0;
+}
+
openvrml_control::browser::resource_fetcher::
resource_fetcher(browser_host & control_host,
uninitialized_plugin_streambuf_map &
@@ -141,59 +480,57 @@
//
const char initial_stream_uri[] = "x-openvrml-initial:";
- struct OPENVRML_LOCAL initial_stream_reader {
- initial_stream_reader(
- const boost::shared_ptr<openvrml_control::plugin_streambuf> &
- streambuf,
- openvrml::browser & browser):
- streambuf_(streambuf),
- browser_(browser)
+}
+
+struct OPENVRML_LOCAL openvrml_control::browser::initial_stream_reader {
+ initial_stream_reader(
+ const boost::shared_ptr<plugin_streambuf> & streambuf,
+ openvrml::browser & browser):
+ streambuf_(streambuf),
+ browser_(browser)
{}
- void operator()() const throw ()
- {
- using openvrml_control::plugin_streambuf;
+ void operator()() const throw ()
+ {
+ class plugin_istream : public openvrml::resource_istream {
+ boost::shared_ptr<plugin_streambuf> streambuf_;
- class plugin_istream : public openvrml::resource_istream {
- boost::shared_ptr<plugin_streambuf> streambuf_;
+ public:
+ explicit plugin_istream(
+ const boost::shared_ptr<plugin_streambuf> & streambuf):
+ openvrml::resource_istream(streambuf.get()),
+ streambuf_(streambuf)
+ {}
- public:
- explicit plugin_istream(
- const boost::shared_ptr<plugin_streambuf> & streambuf):
- openvrml::resource_istream(streambuf.get()),
- streambuf_(streambuf)
- {}
+ virtual ~plugin_istream() throw ()
+ {}
- virtual ~plugin_istream() throw ()
- {}
+ private:
+ virtual const std::string do_url() const throw (std::bad_alloc)
+ {
+ return this->streambuf_->url();
+ }
- private:
- virtual const std::string do_url() const throw (std::bad_alloc)
- {
- return this->streambuf_->url();
- }
+ virtual const std::string do_type() const
+ throw (std::bad_alloc)
+ {
+ return this->streambuf_->type();
+ }
- virtual const std::string do_type() const
- throw (std::bad_alloc)
- {
- return this->streambuf_->type();
- }
+ virtual bool do_data_available() const throw ()
+ {
+ return this->streambuf_->data_available();
+ }
+ } in(this->streambuf_);
- virtual bool do_data_available() const throw ()
- {
- return this->streambuf_->data_available();
- }
- } in(this->streambuf_);
+ this->browser_.set_world(in);
+ }
- this->browser_.set_world(in);
- }
+private:
+ boost::shared_ptr<plugin_streambuf> streambuf_;
+ openvrml::browser & browser_;
+};
- private:
- boost::shared_ptr<openvrml_control::plugin_streambuf> streambuf_;
- openvrml::browser & browser_;
- };
-}
-
openvrml_control::browser::browser(browser_host & host,
const bool expect_initial_stream):
fetcher_(host,
Modified: trunk/src/libopenvrml-control/openvrml_control/browser.h
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/browser.h 2009-03-19 05:46:08 UTC (rev 3849)
+++ trunk/src/libopenvrml-control/openvrml_control/browser.h 2009-03-19 06:30:11 UTC (rev 3850)
@@ -21,7 +21,6 @@
# ifndef OPENVRML_CONTROL_BROWSER_H
# define OPENVRML_CONTROL_BROWSER_H
-# include "plugin_streambuf.h"
# include <openvrml/browser.h>
namespace openvrml_control {
@@ -36,8 +35,43 @@
class browser_host;
class browser {
+ class plugin_streambuf;
+ struct initial_stream_reader;
struct load_url;
+ class uninitialized_plugin_streambuf_map : boost::noncopyable {
+ struct map_entry_matches_streambuf;
+
+ mutable openvrml::read_write_mutex mutex_;
+ typedef std::multimap<std::string,
+ boost::shared_ptr<plugin_streambuf> >
+ map_t;
+ map_t map_;
+
+ public:
+ const boost::shared_ptr<plugin_streambuf>
+ find(const std::string & url) const;
+ void insert(const std::string & url,
+ const boost::shared_ptr<plugin_streambuf> & streambuf);
+ bool erase(const plugin_streambuf & streambuf);
+ size_t size() const;
+ bool empty() const;
+ const boost::shared_ptr<plugin_streambuf> front() const;
+ };
+
+ class plugin_streambuf_map : boost::noncopyable {
+ mutable openvrml::read_write_mutex mutex_;
+ typedef std::map<size_t, boost::shared_ptr<plugin_streambuf> >
+ map_t;
+ map_t map_;
+
+ public:
+ const boost::shared_ptr<plugin_streambuf> find(size_t id) const;
+ bool insert(size_t id,
+ const boost::shared_ptr<plugin_streambuf> & streambuf);
+ bool erase(size_t id);
+ };
+
class resource_fetcher : public openvrml::resource_fetcher {
browser_host & control_host_;
uninitialized_plugin_streambuf_map &
Deleted: trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.cpp
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.cpp 2009-03-19 05:46:08 UTC (rev 3849)
+++ trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.cpp 2009-03-19 06:30:11 UTC (rev 3850)
@@ -1,264 +0,0 @@
-// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
-//
-// OpenVRML Control
-//
-// Copyright 2004, 2005, 2006, 2007, 2008 Braden N. McDaniel
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-// more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; if not, see <http://www.gnu.org/licenses/>.
-//
-
-# include "plugin_streambuf.h"
-
-openvrml_control::plugin_streambuf::
-plugin_streambuf(const std::string & requested_url,
- uninitialized_plugin_streambuf_map & uninitialized_map,
- plugin_streambuf_map & map):
- state_(requested),
- get_url_result_(-1),
- url_(requested_url),
- i_(0),
- c_('\0'),
- uninitialized_map_(uninitialized_map),
- map_(map)
-{
- //
- // This is really just here to emphasize that c_ must not be EOF.
- //
- this->i_ = traits_type::not_eof(this->i_);
- this->c_ =
- traits_type::to_char_type(
- traits_type::not_eof(traits_type::to_int_type(this->c_)));
-
- this->setg(&this->c_, &this->c_, &this->c_);
-}
-
-openvrml_control::plugin_streambuf::state_id
-openvrml_control::plugin_streambuf::state() const
-{
- boost::mutex::scoped_lock lock(this->mutex_);
- return this->state_;
-}
-
-void openvrml_control::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;
-
- //
- // If result is nonzero, the resource fetch failed early (i.e., before
- // actually getting the stream. In that case, nothing else should be
- // playing with this. Removing this streambuf from uninitialized_map_
- // below may (and probably will) result in destruction of this instance.
- //
- // So, anyone waiting on received_get_url_result_ should be doing so
- // because the fetching code is trying to do something with this streambuf
- // because the fetch is in-progress (i.e., succeeding). If you're waiting
- // on this condition and result could possibly indicate failure, you're
- // doing it wrong.
- //
- if (result == 0) {
- this->state_ = plugin_streambuf::uninitialized;
- this->received_get_url_result_.notify_all();
- } else {
- this->uninitialized_map_.erase(*this);
- }
-}
-
-void openvrml_control::plugin_streambuf::init(const size_t stream_id,
- const std::string & received_url,
- const std::string & type)
-{
- assert(stream_id);
- assert(!received_url.empty());
- assert(!type.empty());
-
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->state_ != plugin_streambuf::uninitialized) {
- this->received_get_url_result_.wait(lock);
- }
-
- assert(this->state_ == uninitialized);
-
- bool succeeded = this->uninitialized_map_.erase(*this);
- assert(succeeded);
- this->url_ = received_url;
- this->type_ = type;
- this->state_ = plugin_streambuf::initialized;
- const boost::shared_ptr<plugin_streambuf> this_ = shared_from_this();
- succeeded = this->map_.insert(stream_id, this_);
- assert(succeeded);
- this->streambuf_initialized_or_failed_.notify_all();
-}
-
-void openvrml_control::plugin_streambuf::fail()
-{
- boost::mutex::scoped_lock lock(this->mutex_);
- const bool succeeded = this->uninitialized_map_.erase(*this);
- assert(succeeded);
- this->buf_.set_eof();
- this->streambuf_initialized_or_failed_.notify_all();
-}
-
-const std::string & openvrml_control::plugin_streambuf::url() const
-{
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->state_ != plugin_streambuf::initialized) {
- this->streambuf_initialized_or_failed_.wait(lock);
- }
- return this->url_;
-}
-
-const std::string & openvrml_control::plugin_streambuf::type() const
-{
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->state_ != plugin_streambuf::initialized) {
- this->streambuf_initialized_or_failed_.wait(lock);
- }
- return this->type_;
-}
-
-bool openvrml_control::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_.eof();
-}
-
-openvrml_control::plugin_streambuf::int_type
-openvrml_control::plugin_streambuf::underflow()
-{
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->state_ != plugin_streambuf::initialized) {
- this->streambuf_initialized_or_failed_.wait(lock);
- }
-
- if (traits_type::eq_int_type(this->i_, traits_type::eof())) {
- return traits_type::eof();
- }
-
- this->i_ = this->buf_.get();
- this->c_ = traits_type::to_char_type(this->i_);
-
- if (traits_type::eq_int_type(this->i_, traits_type::eof())) {
- return traits_type::eof();
- }
-
- this->setg(&this->c_, &this->c_, &this->c_ + 1);
- return traits_type::to_int_type(*this->gptr());
-}
-
-const boost::shared_ptr<openvrml_control::plugin_streambuf>
-openvrml_control::uninitialized_plugin_streambuf_map::
-find(const std::string & url) const
-{
- openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
- map_t::const_iterator pos = this->map_.find(url);
- return pos == this->map_.end()
- ? boost::shared_ptr<plugin_streambuf>()
- : pos->second;
-}
-
-void
-openvrml_control::uninitialized_plugin_streambuf_map::
-insert(const std::string & url,
- const boost::shared_ptr<plugin_streambuf> & streambuf)
-{
- openvrml::read_write_mutex::scoped_write_lock lock(this->mutex_);
- this->map_.insert(make_pair(url, streambuf));
-}
-
-struct openvrml_control::uninitialized_plugin_streambuf_map::map_entry_matches_streambuf :
- std::unary_function<bool, map_t::value_type> {
-
- explicit map_entry_matches_streambuf(const plugin_streambuf * streambuf):
- streambuf_(streambuf)
- {}
-
- bool operator()(const map_t::value_type & entry) const
- {
- return this->streambuf_ == entry.second.get();
- }
-
-private:
- const plugin_streambuf * const streambuf_;
-};
-
-bool
-openvrml_control::uninitialized_plugin_streambuf_map::
-erase(const plugin_streambuf & streambuf)
-{
- openvrml::read_write_mutex::scoped_read_write_lock lock(this->mutex_);
- const map_t::iterator pos =
- std::find_if(this->map_.begin(), this->map_.end(),
- map_entry_matches_streambuf(&streambuf));
- if (pos == this->map_.end()) { return false; }
- lock.promote();
- this->map_.erase(pos);
- return true;
-}
-
-size_t openvrml_control::uninitialized_plugin_streambuf_map::size() const
-{
- openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
- return this->map_.size();
-}
-
-bool openvrml_control::uninitialized_plugin_streambuf_map::empty() const
-{
- openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
- return this->map_.empty();
-}
-
-const boost::shared_ptr<openvrml_control::plugin_streambuf>
-openvrml_control::uninitialized_plugin_streambuf_map::front() const
-{
- openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
- assert(!this->map_.empty());
- return this->map_.begin()->second;
-}
-
-
-const boost::shared_ptr<openvrml_control::plugin_streambuf>
-openvrml_control::plugin_streambuf_map::find(const size_t id) const
-{
- openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
- map_t::const_iterator pos = this->map_.find(id);
- return pos == this->map_.end()
- ? boost::shared_ptr<plugin_streambuf>()
- : pos->second;
-}
-
-bool
-openvrml_control::plugin_streambuf_map::
-insert(const size_t id,
- const boost::shared_ptr<plugin_streambuf> & streambuf)
-{
- openvrml::read_write_mutex::scoped_write_lock lock(this->mutex_);
- return this->map_.insert(make_pair(id, streambuf)).second;
-}
-
-/**
- * @brief Erase the entry corresponding to @p id.
- *
- * @return @c true if an entry was removed; @c false otherwise.
- */
-bool openvrml_control::plugin_streambuf_map::erase(const size_t id)
-{
- openvrml::read_write_mutex::scoped_write_lock lock(this->mutex_);
- return this->map_.erase(id) > 0;
-}
Deleted: trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.h
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.h 2009-03-19 05:46:08 UTC (rev 3849)
+++ trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.h 2009-03-19 06:30:11 UTC (rev 3850)
@@ -1,163 +0,0 @@
-// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
-//
-// OpenVRML Control
-//
-// Copyright 2004, 2005, 2006, 2007, 2008 Braden N. McDaniel
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-// more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; if not, see <http://www.gnu.org/licenses/>.
-//
-
-# ifndef OPENVRML_CONTROL_PLUGIN_STREAMBUF_H
-# define OPENVRML_CONTROL_PLUGIN_STREAMBUF_H
-
-# include <map>
-# include <streambuf>
-# include <boost/noncopyable.hpp>
-# include <boost/shared_ptr.hpp>
-# include <boost/enable_shared_from_this.hpp>
-# include <openvrml/read_write_mutex.h>
-# include "bounded_buffer.h"
-
-namespace openvrml_control {
-
- //
- // plugin_streambuf Life Cycle
- //
- // A plugin_streambuf is first created in GtkVrmlBrowser's
- // resource_fetcher::do_get_resource implementation (which is
- // called whenever libopenvrml needs to load a stream).
- //
- // Step 1: Requested plugin_streambuf
- //
- // Upon creation, the plugin_streambuf is inserted into the
- // unintialized_plugin_streambuf_map with an initial
- // plugin_streambuf::state of requested. do_get_resource does not
- // complete until the result of asking the host application to resolve the
- // URL is known; i.e., plugin_streambuf::get_url_result. get_url_result
- // blocks until the response is received from the host application; i.e.,
- // until plugin_streambuf::set_get_url_result has been called.
- //
- // Step 2: Uninitialized plugin_streambuf
- //
- // If plugin_streambuf::set_get_url_result is given a result code
- // indicating success (i.e., 0), the plugin_streambuf::state is changed to
- // uninitialized (otherwise, the stream is removed from the
- // uninitialized_plugin_streambuf_map and we're done). When
- // openvrml_xembed_stream_client_new_stream is called on the
- // GtkVrmlBrowser, a plugin_streambuf matching that URL is gotten from the
- // uninitialized_plugin_streambuf_map and plugin_streambuf::init is called
- // on it. init removes the plugin_streambuf from the
- // uninitialized_plugin_streambuf_map_ and inserts it in the
- // plugin_streambuf_map with a plugin_streambuf::state of initialized.
- //
- // Step 3: Initialized plugin_streambuf (plugin_streambuf_map)
- //
- // The plugin_streambuf_map comprises plugin_streambufs that are being
- // written to in response to openvrml_xembed_stream_client_write calls and
- // read from by stream readers in libopenvrml. Once the host is done
- // calling openvrml_xembed_stream_client_write for a stream, it is
- // expected that it will call
- // openvrml_xembed_stream_client_destroy_stream. In response to this
- // call, bounded_buffer<>::set_eof is called on the plugin_streambuf's
- // underlying bounded_buffer<> and the plugin_streambuf is removed from
- // the plugin_streambuf_map.
- //
- // Once the last reference to the resource_istream corresponding
- // to the plugin_streambuf is removed, the plugin_streambuf is
- // deleted.
- //
-
- class browser;
-
- class uninitialized_plugin_streambuf_map;
- class plugin_streambuf_map;
-
- class plugin_streambuf :
- public boost::enable_shared_from_this<plugin_streambuf>,
- public std::streambuf {
-
- friend class openvrml_control::browser;
-
- public:
- enum state_id {
- requested,
- uninitialized,
- initialized
- };
-
- private:
- state_id state_;
- mutable boost::mutex mutex_;
- int get_url_result_;
- mutable boost::condition received_get_url_result_;
- mutable boost::condition streambuf_initialized_or_failed_;
- std::string url_;
- std::string type_;
- bounded_buffer<char_type, 16384> buf_;
- int_type i_;
- char_type c_;
- uninitialized_plugin_streambuf_map & uninitialized_map_;
- plugin_streambuf_map & map_;
-
- protected:
- virtual int_type underflow();
-
- public:
- plugin_streambuf(const std::string & requested_url,
- uninitialized_plugin_streambuf_map & uninitialized_map,
- plugin_streambuf_map & map);
- state_id state() const;
- void set_get_url_result(int result);
- void init(size_t stream_id,
- const std::string & received_url,
- const std::string & type);
- void fail();
- const std::string & url() const;
- const std::string & type() const;
- bool data_available() const;
- };
-
- class uninitialized_plugin_streambuf_map : boost::noncopyable {
- struct map_entry_matches_streambuf;
-
- mutable openvrml::read_write_mutex mutex_;
- typedef std::multimap<std::string, boost::shared_ptr<plugin_streambuf> >
- map_t;
- map_t map_;
-
- public:
- const boost::shared_ptr<plugin_streambuf>
- find(const std::string & url) const;
- void insert(const std::string & url,
- const boost::shared_ptr<plugin_streambuf> & streambuf);
- bool erase(const plugin_streambuf & streambuf);
- size_t size() const;
- bool empty() const;
- const boost::shared_ptr<plugin_streambuf> front() const;
- };
-
- class plugin_streambuf_map : boost::noncopyable {
- mutable openvrml::read_write_mutex mutex_;
- typedef std::map<size_t, boost::shared_ptr<plugin_streambuf> > map_t;
- map_t map_;
-
- public:
- const boost::shared_ptr<plugin_streambuf> find(size_t id) const;
- bool insert(size_t id,
- const boost::shared_ptr<plugin_streambuf> & streambuf);
- bool erase(size_t id);
- };
-}
-
-# endif // ifndef OPENVRML_CONTROL_PLUGIN_STREAMBUF_H
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-19 05:46:18
|
Revision: 3849
http://openvrml.svn.sourceforge.net/openvrml/?rev=3849&view=rev
Author: braden
Date: 2009-03-19 05:46:08 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Added missing return statement.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/libopenvrml-control/openvrml_control/browser.cpp
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-19 05:27:10 UTC (rev 3848)
+++ trunk/ChangeLog 2009-03-19 05:46:08 UTC (rev 3849)
@@ -1,5 +1,11 @@
2009-03-19 Braden McDaniel <br...@en...>
+ * src/libopenvrml-control/openvrml_control/browser.cpp
+ (openvrml_control::browser_host::get_url(const std::string &)):
+ Added missing return statement.
+
+2009-03-19 Braden McDaniel <br...@en...>
+
Moved bounded_buffer and plugin_streambuf to libopenvrml-control.
* src/Makefile.am
Modified: trunk/src/libopenvrml-control/openvrml_control/browser.cpp
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/browser.cpp 2009-03-19 05:27:10 UTC (rev 3848)
+++ trunk/src/libopenvrml-control/openvrml_control/browser.cpp 2009-03-19 05:46:08 UTC (rev 3849)
@@ -356,5 +356,5 @@
int openvrml_control::browser_host::get_url(const std::string & url)
{
- this->do_get_url(url);
+ return this->do_get_url(url);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-19 05:27:15
|
Revision: 3848
http://openvrml.svn.sourceforge.net/openvrml/?rev=3848&view=rev
Author: braden
Date: 2009-03-19 05:27:10 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Moved bounded_buffer and plugin_streambuf to libopenvrml-control.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/libopenvrml-control/openvrml_control/browser.cpp
trunk/src/libopenvrml-control/openvrml_control/browser.h
Added Paths:
-----------
trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h
trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.cpp
trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.h
Removed Paths:
-------------
trunk/src/openvrml-xembed/bounded_buffer.h
trunk/src/openvrml-xembed/plugin_streambuf.cpp
trunk/src/openvrml-xembed/plugin_streambuf.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-19 04:53:28 UTC (rev 3847)
+++ trunk/ChangeLog 2009-03-19 05:27:10 UTC (rev 3848)
@@ -1,5 +1,60 @@
2009-03-19 Braden McDaniel <br...@en...>
+ Moved bounded_buffer and plugin_streambuf to libopenvrml-control.
+
+ * src/Makefile.am
+ (noinst_HEADERS): Removed openvrml-xembed/bounded_buffer.h and
+ openvrml-xembed/plugin_streambuf.h.
+ (libopenvrml_control_libopenvrml_control_la_SOURCES): Added
+ libopenvrml-control/openvrml_control/plugin_streambuf.{cpp,h} and
+ libopenvrml-control/openvrml_control/bounded_buffer.h.
+ (libopenvrml_control_libopenvrml_control_la_CPPFLAGS): Don't need
+ $(top_srcdir)/src/openvrml-xembed in the include path anymore.
+ (openvrml_xembed_openvrml_xembed_CPPFLAGS): Don't need
+ $(top_srcdir)/src/openvrml-xembed in the include path anymore.
+ (openvrml_xembed_openvrml_xembed_SOURCES): Removed
+ openvrml-xembed/plugin_streambuf.cpp.
+ * src/libopenvrml-control/openvrml_control/bounded_buffer.h: Moved
+ from src/openvrml-xembed/bounded_buffer.h.
+ * src/libopenvrml-control/openvrml_control/browser.cpp
+ (openvrml_control::browser::resource_fetcher::resource_fetcher(
+ browser_host &, uninitialized_plugin_streambuf_map &,
+ plugin_streambuf_map &)): uninitialized_plugin_streambuf_map and
+ plugin_streambuf_map are now in the openvrml_control namespace.
+ (openvrml_control::browser::resource_fetcher::do_get_resource(const
+ std::string &)): plugin_streambuf is now in the openvrml_control
+ namespace.
+ (initial_stream_reader::initial_stream_reader(const
+ boost::shared_ptr<openvrml_control::plugin_streambuf> &,
+ openvrml::browser &)): plugin_streambuf is now in the
+ openvrml_control namespace.
+ (initial_stream_reader::operator()() const): plugin_streambuf is
+ now in the openvrml_control namespace.
+ (openvrml_control::browser::browser(browser_host &, bool)):
+ plugin_streambuf is now in the openvrml_control namespace.
+ (openvrml_control::browser::new_stream(uint64_t, const std::string
+ &, const std::string &)): Removed obsolete reference to
+ openvrml_xembed namespace.
+ (openvrml_control::browser::destroy_stream(uint64_t)): Removed
+ obsolete reference to openvrml_xembed namespace.
+ (openvrml_control::browser::write(uint64_t, const unsigned char *,
+ size_t)): Removed obsolete reference to openvrml_xembed namespace.
+ * src/libopenvrml-control/openvrml_control/browser.h:
+ uninitialized_plugin_streambuf_map and plugin_streambuf_map are
+ now in the openvrml_control namespace.
+ * src/libopenvrml-control/openvrml_control/plugin_streambuf.cpp:
+ Moved from src/openvrml-xembed/plugin_streambuf.cpp.
+ * src/libopenvrml-control/openvrml_control/plugin_streambuf.h:
+ Moved from src/openvrml-xembed/plugin_streambuf.h.
+ * src/openvrml-xembed/bounded_buffer.h: Moved to
+ src/libopenvrml-control/openvrml_control/bounded_buffer.h.
+ * src/openvrml-xembed/plugin_streambuf.cpp: Moved to
+ src/libopenvrml-control/openvrml_control/plugin_streambuf.cpp.
+ * src/openvrml-xembed/plugin_streambuf.h: Moved to
+ src/libopenvrml-control/openvrml_control/plugin_streambuf.h.
+
+2009-03-19 Braden McDaniel <br...@en...>
+
Removed crufty uses of openvrml_xembed namespace.
* src/openvrml-xembed/browser.cpp
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-03-19 04:53:28 UTC (rev 3847)
+++ trunk/src/Makefile.am 2009-03-19 05:27:10 UTC (rev 3848)
@@ -45,8 +45,6 @@
noinst_HEADERS = \
libopenvrml/private.h \
- openvrml-xembed/bounded_buffer.h \
- openvrml-xembed/plugin_streambuf.h \
openvrml-player/filechooserdialog.h
LIBOPENVRML_LIBRARY_VERSION = 8:8:0
@@ -732,9 +730,11 @@
endif
libopenvrml_control_libopenvrml_control_la_SOURCES = \
libopenvrml-control/openvrml_control/browser.cpp \
- libopenvrml-control/openvrml_control/browser.h
+ libopenvrml-control/openvrml_control/browser.h \
+ libopenvrml-control/openvrml_control/plugin_streambuf.cpp \
+ libopenvrml-control/openvrml_control/plugin_streambuf.h \
+ libopenvrml-control/openvrml_control/bounded_buffer.h
libopenvrml_control_libopenvrml_control_la_CPPFLAGS = \
- -I$(top_srcdir)/src/openvrml-xembed \
-I$(top_builddir)/src/libopenvrml \
-I$(top_srcdir)/src/libopenvrml
libopenvrml_control_libopenvrml_control_la_LIBADD = \
@@ -742,7 +742,6 @@
openvrml_xembed_openvrml_xembed_CPPFLAGS = \
-I$(top_builddir)/src/openvrml-xembed \
- -I$(top_srcdir)/src/openvrml-xembed \
-I$(top_srcdir)/src/libopenvrml-control \
-I$(top_builddir)/src/libopenvrml \
-I$(top_srcdir)/src/libopenvrml \
@@ -757,7 +756,6 @@
openvrml-xembed/main.cpp \
openvrml-xembed/browserfactory.cpp \
openvrml-xembed/browserfactory.h \
- openvrml-xembed/plugin_streambuf.cpp \
openvrml-xembed/browser.cpp \
openvrml-xembed/browser.h \
openvrml-xembed/streamclient.cpp \
Copied: trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h (from rev 3845, trunk/src/openvrml-xembed/bounded_buffer.h)
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h (rev 0)
+++ trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h 2009-03-19 05:27:10 UTC (rev 3848)
@@ -0,0 +1,116 @@
+// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
+//
+// OpenVRML Control
+//
+// Copyright 2004, 2005, 2006, 2007 Braden McDaniel
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; if not, see <http://www.gnu.org/licenses/>.
+//
+
+# ifndef OPENVRML_CONTROL_BOUNDED_BUFFER_H
+# define OPENVRML_CONTROL_BOUNDED_BUFFER_H
+
+# include <cassert>
+# include <string>
+# include <boost/thread/mutex.hpp>
+# include <boost/thread/condition.hpp>
+
+namespace openvrml_control {
+
+ template <typename CharT, size_t BufferSize>
+ class bounded_buffer {
+ mutable boost::mutex mutex_;
+ boost::condition buffer_not_full_, buffer_not_empty_or_eof_;
+
+ CharT buf_[BufferSize];
+ size_t begin_, end_, buffered_;
+ bool eof_;
+
+ public:
+ typedef CharT char_type;
+ typedef typename std::char_traits<char_type> traits_type;
+ typedef typename traits_type::int_type int_type;
+
+ bounded_buffer();
+ void put(const char_type & c);
+ int_type get();
+ size_t buffered() const;
+ void set_eof();
+ bool eof() const;
+ };
+
+ template <typename CharT, size_t BufferSize>
+ bounded_buffer<CharT, BufferSize>::bounded_buffer():
+ begin_(0),
+ end_(0),
+ buffered_(0),
+ eof_(false)
+ {}
+
+ template <typename CharT, size_t BufferSize>
+ void bounded_buffer<CharT, BufferSize>::put(const char_type & c)
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->buffered_ == BufferSize) {
+ this->buffer_not_full_.wait(lock);
+ }
+ this->buf_[this->end_] = c;
+ this->end_ = (this->end_ + 1) % BufferSize;
+ ++this->buffered_;
+ this->buffer_not_empty_or_eof_.notify_one();
+ }
+
+ template <typename CharT, size_t BufferSize>
+ typename bounded_buffer<CharT, BufferSize>::int_type
+ bounded_buffer<CharT, BufferSize>::get()
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->buffered_ == 0 && !this->eof_) {
+ this->buffer_not_empty_or_eof_.wait(lock);
+ }
+ if (this->buffered_ == 0 && this->eof_) {
+ return traits_type::eof();
+ }
+ const int_type c = traits_type::to_int_type(this->buf_[this->begin_]);
+ this->begin_ = (this->begin_ + 1) % BufferSize;
+ --this->buffered_;
+ this->buffer_not_full_.notify_one();
+ assert(!traits_type::eq_int_type(c, traits_type::eof()));
+ return c;
+ }
+
+ template <typename CharT, size_t BufferSize>
+ size_t bounded_buffer<CharT, BufferSize>::buffered() const
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ return this->buffered_;
+ }
+
+ template <typename CharT, size_t BufferSize>
+ void bounded_buffer<CharT, BufferSize>::set_eof()
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ this->eof_ = true;
+ this->buffer_not_empty_or_eof_.notify_one();
+ }
+
+ template <typename CharT, size_t BufferSize>
+ bool bounded_buffer<CharT, BufferSize>::eof() const
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ return this->eof_;
+ }
+}
+
+# endif // ifndef OPENVRML_CONTROL_BOUNDED_BUFFER_H
Property changes on: trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+ /branches/0.17/src/openvrml-xembed/bounded_buffer.h:3713,3717,3719,3721,3725,3730,3732,3743,3746,3748,3750,3752,3754,3757,3759-3760,3764,3766,3824,3828,3836
/branches/local/src/openvrml-xembed/bounded_buffer.h:3677-3689
/branches/node-modules/src/openvrml-xembed/bounded_buffer.h:3622-3623,3632-3635,3637-3638,3640-3641,3643-3644,3646-3647,3649-3650,3654-3655,3657-3658,3661-3662,3664-3665,3667-3668,3670-3671,3673-3674,3684-3685,3687-3688,3736-3801
Added: svn:eol-style
+ native
Modified: trunk/src/libopenvrml-control/openvrml_control/browser.cpp
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/browser.cpp 2009-03-19 04:53:28 UTC (rev 3847)
+++ trunk/src/libopenvrml-control/openvrml_control/browser.cpp 2009-03-19 05:27:10 UTC (rev 3848)
@@ -37,9 +37,9 @@
openvrml_control::browser::resource_fetcher::
resource_fetcher(browser_host & control_host,
- openvrml_xembed::uninitialized_plugin_streambuf_map &
+ uninitialized_plugin_streambuf_map &
uninitialized_plugin_streambuf_map,
- openvrml_xembed::plugin_streambuf_map & plugin_streambuf_map):
+ plugin_streambuf_map & plugin_streambuf_map):
control_host_(control_host),
uninitialized_plugin_streambuf_map_(uninitialized_plugin_streambuf_map),
plugin_streambuf_map_(plugin_streambuf_map)
@@ -62,8 +62,6 @@
openvrml_control::browser::resource_fetcher::
do_get_resource(const std::string & uri)
{
- using openvrml_xembed::plugin_streambuf;
-
class plugin_resource_istream : public openvrml::resource_istream {
const boost::shared_ptr<plugin_streambuf> streambuf_;
resource_fetcher & resource_fetcher_;
@@ -145,7 +143,7 @@
struct OPENVRML_LOCAL initial_stream_reader {
initial_stream_reader(
- const boost::shared_ptr<openvrml_xembed::plugin_streambuf> &
+ const boost::shared_ptr<openvrml_control::plugin_streambuf> &
streambuf,
openvrml::browser & browser):
streambuf_(streambuf),
@@ -154,7 +152,7 @@
void operator()() const throw ()
{
- using openvrml_xembed::plugin_streambuf;
+ using openvrml_control::plugin_streambuf;
class plugin_istream : public openvrml::resource_istream {
boost::shared_ptr<plugin_streambuf> streambuf_;
@@ -191,7 +189,7 @@
}
private:
- boost::shared_ptr<openvrml_xembed::plugin_streambuf> streambuf_;
+ boost::shared_ptr<openvrml_control::plugin_streambuf> streambuf_;
openvrml::browser & browser_;
};
}
@@ -215,7 +213,6 @@
if (expect_initial_stream) {
using boost::function0;
using boost::shared_ptr;
- using openvrml_xembed::plugin_streambuf;
const shared_ptr<plugin_streambuf> initial_stream(
new plugin_streambuf(::initial_stream_uri,
@@ -252,7 +249,6 @@
const std::string & uri)
OPENVRML_THROW1(unknown_stream)
{
- using namespace openvrml_xembed;
using boost::shared_ptr;
shared_ptr<plugin_streambuf> streambuf =
@@ -274,7 +270,6 @@
void openvrml_control::browser::destroy_stream(const uint64_t stream_id)
OPENVRML_THROW1(unknown_stream)
{
- using namespace openvrml_xembed;
using boost::shared_ptr;
const shared_ptr<plugin_streambuf> streambuf =
@@ -289,7 +284,6 @@
const size_t size)
OPENVRML_THROW1(unknown_stream)
{
- using namespace openvrml_xembed;
using boost::shared_ptr;
const shared_ptr<plugin_streambuf> streambuf =
Modified: trunk/src/libopenvrml-control/openvrml_control/browser.h
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/browser.h 2009-03-19 04:53:28 UTC (rev 3847)
+++ trunk/src/libopenvrml-control/openvrml_control/browser.h 2009-03-19 05:27:10 UTC (rev 3848)
@@ -40,17 +40,17 @@
class resource_fetcher : public openvrml::resource_fetcher {
browser_host & control_host_;
- openvrml_xembed::uninitialized_plugin_streambuf_map &
+ uninitialized_plugin_streambuf_map &
uninitialized_plugin_streambuf_map_;
- openvrml_xembed::plugin_streambuf_map & plugin_streambuf_map_;
+ plugin_streambuf_map & plugin_streambuf_map_;
boost::thread_group thread_group_;
public:
resource_fetcher(
browser_host & control_host,
- openvrml_xembed::uninitialized_plugin_streambuf_map &
+ uninitialized_plugin_streambuf_map &
uninitialized_plugin_streambuf_map,
- openvrml_xembed::plugin_streambuf_map & plugin_streambuf_map);
+ plugin_streambuf_map & plugin_streambuf_map);
virtual ~resource_fetcher() OPENVRML_NOTHROW;
void create_thread(const boost::function0<void> & threadfunc);
@@ -71,9 +71,9 @@
do_browser_changed(const openvrml::browser_event & event);
};
- openvrml_xembed::uninitialized_plugin_streambuf_map
+ uninitialized_plugin_streambuf_map
uninitialized_streambuf_map_;
- openvrml_xembed::plugin_streambuf_map streambuf_map_;
+ plugin_streambuf_map streambuf_map_;
resource_fetcher fetcher_;
browser_listener listener_;
openvrml::browser browser_;
Copied: trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.cpp (from rev 3845, trunk/src/openvrml-xembed/plugin_streambuf.cpp)
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.cpp (rev 0)
+++ trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.cpp 2009-03-19 05:27:10 UTC (rev 3848)
@@ -0,0 +1,264 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
+//
+// OpenVRML Control
+//
+// Copyright 2004, 2005, 2006, 2007, 2008 Braden N. McDaniel
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; if not, see <http://www.gnu.org/licenses/>.
+//
+
+# include "plugin_streambuf.h"
+
+openvrml_control::plugin_streambuf::
+plugin_streambuf(const std::string & requested_url,
+ uninitialized_plugin_streambuf_map & uninitialized_map,
+ plugin_streambuf_map & map):
+ state_(requested),
+ get_url_result_(-1),
+ url_(requested_url),
+ i_(0),
+ c_('\0'),
+ uninitialized_map_(uninitialized_map),
+ map_(map)
+{
+ //
+ // This is really just here to emphasize that c_ must not be EOF.
+ //
+ this->i_ = traits_type::not_eof(this->i_);
+ this->c_ =
+ traits_type::to_char_type(
+ traits_type::not_eof(traits_type::to_int_type(this->c_)));
+
+ this->setg(&this->c_, &this->c_, &this->c_);
+}
+
+openvrml_control::plugin_streambuf::state_id
+openvrml_control::plugin_streambuf::state() const
+{
+ boost::mutex::scoped_lock lock(this->mutex_);
+ return this->state_;
+}
+
+void openvrml_control::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;
+
+ //
+ // If result is nonzero, the resource fetch failed early (i.e., before
+ // actually getting the stream. In that case, nothing else should be
+ // playing with this. Removing this streambuf from uninitialized_map_
+ // below may (and probably will) result in destruction of this instance.
+ //
+ // So, anyone waiting on received_get_url_result_ should be doing so
+ // because the fetching code is trying to do something with this streambuf
+ // because the fetch is in-progress (i.e., succeeding). If you're waiting
+ // on this condition and result could possibly indicate failure, you're
+ // doing it wrong.
+ //
+ if (result == 0) {
+ this->state_ = plugin_streambuf::uninitialized;
+ this->received_get_url_result_.notify_all();
+ } else {
+ this->uninitialized_map_.erase(*this);
+ }
+}
+
+void openvrml_control::plugin_streambuf::init(const size_t stream_id,
+ const std::string & received_url,
+ const std::string & type)
+{
+ assert(stream_id);
+ assert(!received_url.empty());
+ assert(!type.empty());
+
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->state_ != plugin_streambuf::uninitialized) {
+ this->received_get_url_result_.wait(lock);
+ }
+
+ assert(this->state_ == uninitialized);
+
+ bool succeeded = this->uninitialized_map_.erase(*this);
+ assert(succeeded);
+ this->url_ = received_url;
+ this->type_ = type;
+ this->state_ = plugin_streambuf::initialized;
+ const boost::shared_ptr<plugin_streambuf> this_ = shared_from_this();
+ succeeded = this->map_.insert(stream_id, this_);
+ assert(succeeded);
+ this->streambuf_initialized_or_failed_.notify_all();
+}
+
+void openvrml_control::plugin_streambuf::fail()
+{
+ boost::mutex::scoped_lock lock(this->mutex_);
+ const bool succeeded = this->uninitialized_map_.erase(*this);
+ assert(succeeded);
+ this->buf_.set_eof();
+ this->streambuf_initialized_or_failed_.notify_all();
+}
+
+const std::string & openvrml_control::plugin_streambuf::url() const
+{
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->state_ != plugin_streambuf::initialized) {
+ this->streambuf_initialized_or_failed_.wait(lock);
+ }
+ return this->url_;
+}
+
+const std::string & openvrml_control::plugin_streambuf::type() const
+{
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->state_ != plugin_streambuf::initialized) {
+ this->streambuf_initialized_or_failed_.wait(lock);
+ }
+ return this->type_;
+}
+
+bool openvrml_control::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_.eof();
+}
+
+openvrml_control::plugin_streambuf::int_type
+openvrml_control::plugin_streambuf::underflow()
+{
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->state_ != plugin_streambuf::initialized) {
+ this->streambuf_initialized_or_failed_.wait(lock);
+ }
+
+ if (traits_type::eq_int_type(this->i_, traits_type::eof())) {
+ return traits_type::eof();
+ }
+
+ this->i_ = this->buf_.get();
+ this->c_ = traits_type::to_char_type(this->i_);
+
+ if (traits_type::eq_int_type(this->i_, traits_type::eof())) {
+ return traits_type::eof();
+ }
+
+ this->setg(&this->c_, &this->c_, &this->c_ + 1);
+ return traits_type::to_int_type(*this->gptr());
+}
+
+const boost::shared_ptr<openvrml_control::plugin_streambuf>
+openvrml_control::uninitialized_plugin_streambuf_map::
+find(const std::string & url) const
+{
+ openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
+ map_t::const_iterator pos = this->map_.find(url);
+ return pos == this->map_.end()
+ ? boost::shared_ptr<plugin_streambuf>()
+ : pos->second;
+}
+
+void
+openvrml_control::uninitialized_plugin_streambuf_map::
+insert(const std::string & url,
+ const boost::shared_ptr<plugin_streambuf> & streambuf)
+{
+ openvrml::read_write_mutex::scoped_write_lock lock(this->mutex_);
+ this->map_.insert(make_pair(url, streambuf));
+}
+
+struct openvrml_control::uninitialized_plugin_streambuf_map::map_entry_matches_streambuf :
+ std::unary_function<bool, map_t::value_type> {
+
+ explicit map_entry_matches_streambuf(const plugin_streambuf * streambuf):
+ streambuf_(streambuf)
+ {}
+
+ bool operator()(const map_t::value_type & entry) const
+ {
+ return this->streambuf_ == entry.second.get();
+ }
+
+private:
+ const plugin_streambuf * const streambuf_;
+};
+
+bool
+openvrml_control::uninitialized_plugin_streambuf_map::
+erase(const plugin_streambuf & streambuf)
+{
+ openvrml::read_write_mutex::scoped_read_write_lock lock(this->mutex_);
+ const map_t::iterator pos =
+ std::find_if(this->map_.begin(), this->map_.end(),
+ map_entry_matches_streambuf(&streambuf));
+ if (pos == this->map_.end()) { return false; }
+ lock.promote();
+ this->map_.erase(pos);
+ return true;
+}
+
+size_t openvrml_control::uninitialized_plugin_streambuf_map::size() const
+{
+ openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
+ return this->map_.size();
+}
+
+bool openvrml_control::uninitialized_plugin_streambuf_map::empty() const
+{
+ openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
+ return this->map_.empty();
+}
+
+const boost::shared_ptr<openvrml_control::plugin_streambuf>
+openvrml_control::uninitialized_plugin_streambuf_map::front() const
+{
+ openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
+ assert(!this->map_.empty());
+ return this->map_.begin()->second;
+}
+
+
+const boost::shared_ptr<openvrml_control::plugin_streambuf>
+openvrml_control::plugin_streambuf_map::find(const size_t id) const
+{
+ openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
+ map_t::const_iterator pos = this->map_.find(id);
+ return pos == this->map_.end()
+ ? boost::shared_ptr<plugin_streambuf>()
+ : pos->second;
+}
+
+bool
+openvrml_control::plugin_streambuf_map::
+insert(const size_t id,
+ const boost::shared_ptr<plugin_streambuf> & streambuf)
+{
+ openvrml::read_write_mutex::scoped_write_lock lock(this->mutex_);
+ return this->map_.insert(make_pair(id, streambuf)).second;
+}
+
+/**
+ * @brief Erase the entry corresponding to @p id.
+ *
+ * @return @c true if an entry was removed; @c false otherwise.
+ */
+bool openvrml_control::plugin_streambuf_map::erase(const size_t id)
+{
+ openvrml::read_write_mutex::scoped_write_lock lock(this->mutex_);
+ return this->map_.erase(id) > 0;
+}
Property changes on: trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.cpp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+ /branches/0.17/src/openvrml-xembed/plugin_streambuf.cpp:3713,3717,3719,3721,3725,3730,3732,3743,3746,3748,3750,3752,3754,3757,3759-3760,3764,3766,3824,3828,3836
/branches/local/src/openvrml-xembed/plugin_streambuf.cpp:3677-3689
/branches/node-modules/src/openvrml-xembed/plugin_streambuf.cpp:3622-3623,3632-3635,3637-3638,3640-3641,3643-3644,3646-3647,3649-3650,3654-3655,3657-3658,3661-3662,3664-3665,3667-3668,3670-3671,3673-3674,3684-3685,3687-3688,3736-3801
Added: svn:eol-style
+ native
Copied: trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.h (from rev 3846, trunk/src/openvrml-xembed/plugin_streambuf.h)
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.h (rev 0)
+++ trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.h 2009-03-19 05:27:10 UTC (rev 3848)
@@ -0,0 +1,163 @@
+// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
+//
+// OpenVRML Control
+//
+// Copyright 2004, 2005, 2006, 2007, 2008 Braden N. McDaniel
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; if not, see <http://www.gnu.org/licenses/>.
+//
+
+# ifndef OPENVRML_CONTROL_PLUGIN_STREAMBUF_H
+# define OPENVRML_CONTROL_PLUGIN_STREAMBUF_H
+
+# include <map>
+# include <streambuf>
+# include <boost/noncopyable.hpp>
+# include <boost/shared_ptr.hpp>
+# include <boost/enable_shared_from_this.hpp>
+# include <openvrml/read_write_mutex.h>
+# include "bounded_buffer.h"
+
+namespace openvrml_control {
+
+ //
+ // plugin_streambuf Life Cycle
+ //
+ // A plugin_streambuf is first created in GtkVrmlBrowser's
+ // resource_fetcher::do_get_resource implementation (which is
+ // called whenever libopenvrml needs to load a stream).
+ //
+ // Step 1: Requested plugin_streambuf
+ //
+ // Upon creation, the plugin_streambuf is inserted into the
+ // unintialized_plugin_streambuf_map with an initial
+ // plugin_streambuf::state of requested. do_get_resource does not
+ // complete until the result of asking the host application to resolve the
+ // URL is known; i.e., plugin_streambuf::get_url_result. get_url_result
+ // blocks until the response is received from the host application; i.e.,
+ // until plugin_streambuf::set_get_url_result has been called.
+ //
+ // Step 2: Uninitialized plugin_streambuf
+ //
+ // If plugin_streambuf::set_get_url_result is given a result code
+ // indicating success (i.e., 0), the plugin_streambuf::state is changed to
+ // uninitialized (otherwise, the stream is removed from the
+ // uninitialized_plugin_streambuf_map and we're done). When
+ // openvrml_xembed_stream_client_new_stream is called on the
+ // GtkVrmlBrowser, a plugin_streambuf matching that URL is gotten from the
+ // uninitialized_plugin_streambuf_map and plugin_streambuf::init is called
+ // on it. init removes the plugin_streambuf from the
+ // uninitialized_plugin_streambuf_map_ and inserts it in the
+ // plugin_streambuf_map with a plugin_streambuf::state of initialized.
+ //
+ // Step 3: Initialized plugin_streambuf (plugin_streambuf_map)
+ //
+ // The plugin_streambuf_map comprises plugin_streambufs that are being
+ // written to in response to openvrml_xembed_stream_client_write calls and
+ // read from by stream readers in libopenvrml. Once the host is done
+ // calling openvrml_xembed_stream_client_write for a stream, it is
+ // expected that it will call
+ // openvrml_xembed_stream_client_destroy_stream. In response to this
+ // call, bounded_buffer<>::set_eof is called on the plugin_streambuf's
+ // underlying bounded_buffer<> and the plugin_streambuf is removed from
+ // the plugin_streambuf_map.
+ //
+ // Once the last reference to the resource_istream corresponding
+ // to the plugin_streambuf is removed, the plugin_streambuf is
+ // deleted.
+ //
+
+ class browser;
+
+ class uninitialized_plugin_streambuf_map;
+ class plugin_streambuf_map;
+
+ class plugin_streambuf :
+ public boost::enable_shared_from_this<plugin_streambuf>,
+ public std::streambuf {
+
+ friend class openvrml_control::browser;
+
+ public:
+ enum state_id {
+ requested,
+ uninitialized,
+ initialized
+ };
+
+ private:
+ state_id state_;
+ mutable boost::mutex mutex_;
+ int get_url_result_;
+ mutable boost::condition received_get_url_result_;
+ mutable boost::condition streambuf_initialized_or_failed_;
+ std::string url_;
+ std::string type_;
+ bounded_buffer<char_type, 16384> buf_;
+ int_type i_;
+ char_type c_;
+ uninitialized_plugin_streambuf_map & uninitialized_map_;
+ plugin_streambuf_map & map_;
+
+ protected:
+ virtual int_type underflow();
+
+ public:
+ plugin_streambuf(const std::string & requested_url,
+ uninitialized_plugin_streambuf_map & uninitialized_map,
+ plugin_streambuf_map & map);
+ state_id state() const;
+ void set_get_url_result(int result);
+ void init(size_t stream_id,
+ const std::string & received_url,
+ const std::string & type);
+ void fail();
+ const std::string & url() const;
+ const std::string & type() const;
+ bool data_available() const;
+ };
+
+ class uninitialized_plugin_streambuf_map : boost::noncopyable {
+ struct map_entry_matches_streambuf;
+
+ mutable openvrml::read_write_mutex mutex_;
+ typedef std::multimap<std::string, boost::shared_ptr<plugin_streambuf> >
+ map_t;
+ map_t map_;
+
+ public:
+ const boost::shared_ptr<plugin_streambuf>
+ find(const std::string & url) const;
+ void insert(const std::string & url,
+ const boost::shared_ptr<plugin_streambuf> & streambuf);
+ bool erase(const plugin_streambuf & streambuf);
+ size_t size() const;
+ bool empty() const;
+ const boost::shared_ptr<plugin_streambuf> front() const;
+ };
+
+ class plugin_streambuf_map : boost::noncopyable {
+ mutable openvrml::read_write_mutex mutex_;
+ typedef std::map<size_t, boost::shared_ptr<plugin_streambuf> > map_t;
+ map_t map_;
+
+ public:
+ const boost::shared_ptr<plugin_streambuf> find(size_t id) const;
+ bool insert(size_t id,
+ const boost::shared_ptr<plugin_streambuf> & streambuf);
+ bool erase(size_t id);
+ };
+}
+
+# endif // ifndef OPENVRML_CONTROL_PLUGIN_STREAMBUF_H
Property changes on: trunk/src/libopenvrml-control/openvrml_control/plugin_streambuf.h
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Deleted: trunk/src/openvrml-xembed/bounded_buffer.h
===================================================================
--- trunk/src/openvrml-xembed/bounded_buffer.h 2009-03-19 04:53:28 UTC (rev 3847)
+++ trunk/src/openvrml-xembed/bounded_buffer.h 2009-03-19 05:27:10 UTC (rev 3848)
@@ -1,116 +0,0 @@
-// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
-//
-// OpenVRML XEmbed Control
-//
-// Copyright 2004, 2005, 2006, 2007 Braden McDaniel
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-// more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; if not, see <http://www.gnu.org/licenses/>.
-//
-
-# ifndef OPENVRML_XEMBED_BOUNDED_BUFFER_H
-# define OPENVRML_XEMBED_BOUNDED_BUFFER_H
-
-# include <cassert>
-# include <string>
-# include <boost/thread/mutex.hpp>
-# include <boost/thread/condition.hpp>
-
-namespace openvrml_xembed {
-
- template <typename CharT, size_t BufferSize>
- class bounded_buffer {
- mutable boost::mutex mutex_;
- boost::condition buffer_not_full_, buffer_not_empty_or_eof_;
-
- CharT buf_[BufferSize];
- size_t begin_, end_, buffered_;
- bool eof_;
-
- public:
- typedef CharT char_type;
- typedef typename std::char_traits<char_type> traits_type;
- typedef typename traits_type::int_type int_type;
-
- bounded_buffer();
- void put(const char_type & c);
- int_type get();
- size_t buffered() const;
- void set_eof();
- bool eof() const;
- };
-
- template <typename CharT, size_t BufferSize>
- bounded_buffer<CharT, BufferSize>::bounded_buffer():
- begin_(0),
- end_(0),
- buffered_(0),
- eof_(false)
- {}
-
- template <typename CharT, size_t BufferSize>
- void bounded_buffer<CharT, BufferSize>::put(const char_type & c)
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->buffered_ == BufferSize) {
- this->buffer_not_full_.wait(lock);
- }
- this->buf_[this->end_] = c;
- this->end_ = (this->end_ + 1) % BufferSize;
- ++this->buffered_;
- this->buffer_not_empty_or_eof_.notify_one();
- }
-
- template <typename CharT, size_t BufferSize>
- typename bounded_buffer<CharT, BufferSize>::int_type
- bounded_buffer<CharT, BufferSize>::get()
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->buffered_ == 0 && !this->eof_) {
- this->buffer_not_empty_or_eof_.wait(lock);
- }
- if (this->buffered_ == 0 && this->eof_) {
- return traits_type::eof();
- }
- const int_type c = traits_type::to_int_type(this->buf_[this->begin_]);
- this->begin_ = (this->begin_ + 1) % BufferSize;
- --this->buffered_;
- this->buffer_not_full_.notify_one();
- assert(!traits_type::eq_int_type(c, traits_type::eof()));
- return c;
- }
-
- template <typename CharT, size_t BufferSize>
- size_t bounded_buffer<CharT, BufferSize>::buffered() const
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- return this->buffered_;
- }
-
- template <typename CharT, size_t BufferSize>
- void bounded_buffer<CharT, BufferSize>::set_eof()
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- this->eof_ = true;
- this->buffer_not_empty_or_eof_.notify_one();
- }
-
- template <typename CharT, size_t BufferSize>
- bool bounded_buffer<CharT, BufferSize>::eof() const
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- return this->eof_;
- }
-}
-
-# endif // ifndef OPENVRML_XEMBED_BOUNDED_BUFFER_H
Deleted: trunk/src/openvrml-xembed/plugin_streambuf.cpp
===================================================================
--- trunk/src/openvrml-xembed/plugin_streambuf.cpp 2009-03-19 04:53:28 UTC (rev 3847)
+++ trunk/src/openvrml-xembed/plugin_streambuf.cpp 2009-03-19 05:27:10 UTC (rev 3848)
@@ -1,265 +0,0 @@
-// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
-//
-// OpenVRML XEmbed Control
-//
-// Copyright 2004, 2005, 2006, 2007, 2008 Braden N. McDaniel
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-// more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; if not, see <http://www.gnu.org/licenses/>.
-//
-
-# include <glib.h>
-# include "plugin_streambuf.h"
-
-openvrml_xembed::plugin_streambuf::
-plugin_streambuf(const std::string & requested_url,
- uninitialized_plugin_streambuf_map & uninitialized_map,
- plugin_streambuf_map & map):
- state_(requested),
- get_url_result_(-1),
- url_(requested_url),
- i_(0),
- c_('\0'),
- uninitialized_map_(uninitialized_map),
- map_(map)
-{
- //
- // This is really just here to emphasize that c_ must not be EOF.
- //
- this->i_ = traits_type::not_eof(this->i_);
- this->c_ =
- traits_type::to_char_type(
- traits_type::not_eof(traits_type::to_int_type(this->c_)));
-
- this->setg(&this->c_, &this->c_, &this->c_);
-}
-
-openvrml_xembed::plugin_streambuf::state_id
-openvrml_xembed::plugin_streambuf::state() const
-{
- boost::mutex::scoped_lock lock(this->mutex_);
- return this->state_;
-}
-
-void openvrml_xembed::plugin_streambuf::set_get_url_result(const int result)
-{
- boost::mutex::scoped_lock lock(this->mutex_);
- g_assert(this->get_url_result_ == -1);
- this->get_url_result_ = result;
-
- //
- // If result is nonzero, the resource fetch failed early (i.e., before
- // actually getting the stream. In that case, nothing else should be
- // playing with this. Removing this streambuf from uninitialized_map_
- // below may (and probably will) result in destruction of this instance.
- //
- // So, anyone waiting on received_get_url_result_ should be doing so
- // because the fetching code is trying to do something with this streambuf
- // because the fetch is in-progress (i.e., succeeding). If you're waiting
- // on this condition and result could possibly indicate failure, you're
- // doing it wrong.
- //
- if (result == 0) {
- this->state_ = plugin_streambuf::uninitialized;
- this->received_get_url_result_.notify_all();
- } else {
- this->uninitialized_map_.erase(*this);
- }
-}
-
-void openvrml_xembed::plugin_streambuf::init(const size_t stream_id,
- const std::string & received_url,
- const std::string & type)
-{
- g_assert(stream_id);
- g_assert(!received_url.empty());
- g_assert(!type.empty());
-
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->state_ != plugin_streambuf::uninitialized) {
- this->received_get_url_result_.wait(lock);
- }
-
- g_assert(this->state_ == uninitialized);
-
- bool succeeded = this->uninitialized_map_.erase(*this);
- g_assert(succeeded);
- this->url_ = received_url;
- this->type_ = type;
- this->state_ = plugin_streambuf::initialized;
- const boost::shared_ptr<plugin_streambuf> this_ = shared_from_this();
- succeeded = this->map_.insert(stream_id, this_);
- g_assert(succeeded);
- this->streambuf_initialized_or_failed_.notify_all();
-}
-
-void openvrml_xembed::plugin_streambuf::fail()
-{
- boost::mutex::scoped_lock lock(this->mutex_);
- const bool succeeded = this->uninitialized_map_.erase(*this);
- g_assert(succeeded);
- this->buf_.set_eof();
- this->streambuf_initialized_or_failed_.notify_all();
-}
-
-const std::string & openvrml_xembed::plugin_streambuf::url() const
-{
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->state_ != plugin_streambuf::initialized) {
- this->streambuf_initialized_or_failed_.wait(lock);
- }
- return this->url_;
-}
-
-const std::string & openvrml_xembed::plugin_streambuf::type() const
-{
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->state_ != plugin_streambuf::initialized) {
- this->streambuf_initialized_or_failed_.wait(lock);
- }
- return this->type_;
-}
-
-bool openvrml_xembed::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_.eof();
-}
-
-openvrml_xembed::plugin_streambuf::int_type
-openvrml_xembed::plugin_streambuf::underflow()
-{
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->state_ != plugin_streambuf::initialized) {
- this->streambuf_initialized_or_failed_.wait(lock);
- }
-
- if (traits_type::eq_int_type(this->i_, traits_type::eof())) {
- return traits_type::eof();
- }
-
- this->i_ = this->buf_.get();
- this->c_ = traits_type::to_char_type(this->i_);
-
- if (traits_type::eq_int_type(this->i_, traits_type::eof())) {
- return traits_type::eof();
- }
-
- this->setg(&this->c_, &this->c_, &this->c_ + 1);
- return traits_type::to_int_type(*this->gptr());
-}
-
-const boost::shared_ptr<openvrml_xembed::plugin_streambuf>
-openvrml_xembed::uninitialized_plugin_streambuf_map::
-find(const std::string & url) const
-{
- openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
- map_t::const_iterator pos = this->map_.find(url);
- return pos == this->map_.end()
- ? boost::shared_ptr<plugin_streambuf>()
- : pos->second;
-}
-
-void
-openvrml_xembed::uninitialized_plugin_streambuf_map::
-insert(const std::string & url,
- const boost::shared_ptr<plugin_streambuf> & streambuf)
-{
- openvrml::read_write_mutex::scoped_write_lock lock(this->mutex_);
- this->map_.insert(make_pair(url, streambuf));
-}
-
-struct openvrml_xembed::uninitialized_plugin_streambuf_map::map_entry_matches_streambuf :
- std::unary_function<bool, map_t::value_type> {
-
- explicit map_entry_matches_streambuf(const plugin_streambuf * streambuf):
- streambuf_(streambuf)
- {}
-
- bool operator()(const map_t::value_type & entry) const
- {
- return this->streambuf_ == entry.second.get();
- }
-
-private:
- const plugin_streambuf * const streambuf_;
-};
-
-bool
-openvrml_xembed::uninitialized_plugin_streambuf_map::
-erase(const plugin_streambuf & streambuf)
-{
- openvrml::read_write_mutex::scoped_read_write_lock lock(this->mutex_);
- const map_t::iterator pos =
- std::find_if(this->map_.begin(), this->map_.end(),
- map_entry_matches_streambuf(&streambuf));
- if (pos == this->map_.end()) { return false; }
- lock.promote();
- this->map_.erase(pos);
- return true;
-}
-
-size_t openvrml_xembed::uninitialized_plugin_streambuf_map::size() const
-{
- openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
- return this->map_.size();
-}
-
-bool openvrml_xembed::uninitialized_plugin_streambuf_map::empty() const
-{
- openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
- return this->map_.empty();
-}
-
-const boost::shared_ptr<openvrml_xembed::plugin_streambuf>
-openvrml_xembed::uninitialized_plugin_streambuf_map::front() const
-{
- openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
- g_assert(!this->map_.empty());
- return this->map_.begin()->second;
-}
-
-
-const boost::shared_ptr<openvrml_xembed::plugin_streambuf>
-openvrml_xembed::plugin_streambuf_map::find(const size_t id) const
-{
- openvrml::read_write_mutex::scoped_read_lock lock(this->mutex_);
- map_t::const_iterator pos = this->map_.find(id);
- return pos == this->map_.end()
- ? boost::shared_ptr<plugin_streambuf>()
- : pos->second;
-}
-
-bool
-openvrml_xembed::plugin_streambuf_map::
-insert(const size_t id,
- const boost::shared_ptr<plugin_streambuf> & streambuf)
-{
- openvrml::read_write_mutex::scoped_write_lock lock(this->mutex_);
- return this->map_.insert(make_pair(id, streambuf)).second;
-}
-
-/**
- * @brief Erase the entry corresponding to @p id.
- *
- * @return @c true if an entry was removed; @c false otherwise.
- */
-bool openvrml_xembed::plugin_streambuf_map::erase(const size_t id)
-{
- openvrml::read_write_mutex::scoped_write_lock lock(this->mutex_);
- return this->map_.erase(id) > 0;
-}
Deleted: trunk/src/openvrml-xembed/plugin_streambuf.h
===================================================================
--- trunk/src/openvrml-xembed/plugin_streambuf.h 2009-03-19 04:53:28 UTC (rev 3847)
+++ trunk/src/openvrml-xembed/plugin_streambuf.h 2009-03-19 05:27:10 UTC (rev 3848)
@@ -1,165 +0,0 @@
-// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
-//
-// OpenVRML XEmbed Control
-//
-// Copyright 2004, 2005, 2006, 2007, 2008 Braden N. McDaniel
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-// more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; if not, see <http://www.gnu.org/licenses/>.
-//
-
-# ifndef OPENVRML_XEMBED_PLUGIN_STREAMBUF_H
-# define OPENVRML_XEMBED_PLUGIN_STREAMBUF_H
-
-# include <map>
-# include <streambuf>
-# include <boost/noncopyable.hpp>
-# include <boost/shared_ptr.hpp>
-# include <boost/enable_shared_from_this.hpp>
-# include <openvrml/read_write_mutex.h>
-# include "bounded_buffer.h"
-
-namespace openvrml_control {
- class browser;
-}
-
-namespace openvrml_xembed {
-
- //
- // plugin_streambuf Life Cycle
- //
- // A plugin_streambuf is first created in GtkVrmlBrowser's
- // resource_fetcher::do_get_resource implementation (which is
- // called whenever libopenvrml needs to load a stream).
- //
- // Step 1: Requested plugin_streambuf
- //
- // Upon creation, the plugin_streambuf is inserted into the
- // unintialized_plugin_streambuf_map with an initial
- // plugin_streambuf::state of requested. do_get_resource does not
- // complete until the result of asking the host application to resolve the
- // URL is known; i.e., plugin_streambuf::get_url_result. get_url_result
- // blocks until the response is received from the host application; i.e.,
- // until plugin_streambuf::set_get_url_result has been called.
- //
- // Step 2: Uninitialized plugin_streambuf
- //
- // If plugin_streambuf::set_get_url_result is given a result code
- // indicating success (i.e., 0), the plugin_streambuf::state is changed to
- // uninitialized (otherwise, the stream is removed from the
- // uninitialized_plugin_streambuf_map and we're done). When
- // openvrml_xembed_stream_client_new_stream is called on the
- // GtkVrmlBrowser, a plugin_streambuf matching that URL is gotten from the
- // uninitialized_plugin_streambuf_map and plugin_streambuf::init is called
- // on it. init removes the plugin_streambuf from the
- // uninitialized_plugin_streambuf_map_ and inserts it in the
- // plugin_streambuf_map with a plugin_streambuf::state of initialized.
- //
- // Step 3: Initialized plugin_streambuf (plugin_streambuf_map)
- //
- // The plugin_streambuf_map comprises plugin_streambufs that are being
- // written to in response to openvrml_xembed_stream_client_write calls and
- // read from by stream readers in libopenvrml. Once the host is done
- // calling openvrml_xembed_stream_client_write for a stream, it is
- // expected that it will call
- // openvrml_xembed_stream_client_destroy_stream. In response to this
- // call, bounded_buffer<>::set_eof is called on the plugin_streambuf's
- // underlying bounded_buffer<> and the plugin_streambuf is removed from
- // the plugin_streambuf_map.
- //
- // Once the last reference to the resource_istream corresponding
- // to the plugin_streambuf is removed, the plugin_streambuf is
- // deleted.
- //
-
- class uninitialized_plugin_streambuf_map;
- class plugin_streambuf_map;
-
- class plugin_streambuf :
- public boost::enable_shared_from_this<plugin_streambuf>,
- public std::streambuf {
-
- friend class openvrml_control::browser;
-
- public:
- enum state_id {
- requested,
- uninitialized,
- initialized
- };
-
- private:
- state_id state_;
- mutable boost::mutex mutex_;
- int get_url_result_;
- mutable boost::condition received_get_url_result_;
- mutable boost::condition streambuf_initialized_or_failed_;
- std::string url_;
- std::string type_;
- bounded_buffer<char_type, 16384> buf_;
- int_type i_;
- char_type c_;
- uninitialized_plugin_streambuf_map & uninitialized_map_;
- plugin_streambuf_map & map_;
-
- protected:
- virtual int_type underflow();
-
- public:
- plugin_streambuf(const std::string & requested_url,
- uninitialized_plugin_streambuf_map & uninitialized_map,
- plugin_streambuf_map & map);
- state_id state() const;
- void set_get_url_result(int result);
- void init(size_t stream_id,
- const std::string & received_url,
- const std::string & type);
- void fail();
- const std::string & url() const;
- const std::string & type() const;
- bool data_available() const;
- };
-
- class uninitialized_plugin_streambuf_map : boost::noncopyable {
- struct map_entry_matches_streambuf;
-
- mutable openvrml::read_write_mutex mutex_;
- typedef std::multimap<std::string, boost::shared_ptr<plugin_streambuf> >
- map_t;
- map_t map_;
-
- public:
- const boost::shared_ptr<plugin_streambuf>
- find(const std::string & url) const;
- void insert(const std::string & url,
- const boost::shared_ptr<plugin_streambuf> & streambuf);
- bool erase(const plugin_streambuf & streambuf);
- size_t size() const;
- bool empty() const;
- const boost::shared_ptr<plugin_streambuf> front() const;
- };
-
- class plugin_streambuf_map : boost::noncopyable {
- mutable openvrml::read_write_mutex mutex_;
- typedef std::map<size_t, boost::shared_ptr<plugin_streambuf> > map_t;
- map_t map_;
-
- public:
- const boost::shared_ptr<plugin_streambuf> find(size_t id) const;
- bool insert(size_t id,
- const boost::shared_ptr<plugin_streambuf> & streambuf);
- bool erase(size_t id);
- };
-}
-
-# endif // ifndef OPENVRML_XEMBED_PLUGIN_STREAMBUF_H
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-19 04:53:33
|
Revision: 3847
http://openvrml.svn.sourceforge.net/openvrml/?rev=3847&view=rev
Author: braden
Date: 2009-03-19 04:53:28 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Removed crufty uses of openvrml_xembed namespace.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/openvrml-xembed/browser.cpp
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-19 04:19:27 UTC (rev 3846)
+++ trunk/ChangeLog 2009-03-19 04:53:28 UTC (rev 3847)
@@ -1,5 +1,20 @@
2009-03-19 Braden McDaniel <br...@en...>
+ Removed crufty uses of openvrml_xembed namespace.
+
+ * src/openvrml-xembed/browser.cpp
+ (openvrml_xembed_browser_new_stream(OpenvrmlXembedStreamClient *,
+ guint64, const char *, const char *, GError **)): Removed crufty
+ use of openvrml_xembed namespace.
+ (openvrml_xembed_browser_destroy_stream(OpenvrmlXembedStreamClient *,
+ guint64, GError **)): Removed crufty use of openvrml_xembed
+ namespace.
+ (openvrml_xembed_browser_write(OpenvrmlXembedStreamClient *,
+ guint64, const GArray *, GError **)): Removed crufty use of
+ openvrml_xembed namespace.
+
+2009-03-19 Braden McDaniel <br...@en...>
+
Created a convenience library libopenvrml-control to hold the
platform-independent parts of the OpenVRML control (which is
currently called openvrml-xembed).
Modified: trunk/src/openvrml-xembed/browser.cpp
===================================================================
--- trunk/src/openvrml-xembed/browser.cpp 2009-03-19 04:19:27 UTC (rev 3846)
+++ trunk/src/openvrml-xembed/browser.cpp 2009-03-19 04:53:28 UTC (rev 3847)
@@ -349,7 +349,6 @@
const char * const url,
GError ** const error)
{
- using namespace openvrml_xembed;
using boost::shared_ptr;
OpenvrmlXembedBrowser * const browser =
@@ -373,7 +372,6 @@
const guint64 stream_id,
GError ** const error)
{
- using namespace openvrml_xembed;
using boost::shared_ptr;
OpenvrmlXembedBrowser * const browser =
@@ -397,7 +395,6 @@
const GArray * const data,
GError ** const error)
{
- using namespace openvrml_xembed;
using boost::shared_ptr;
OpenvrmlXembedBrowser * const browser =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-19 04:19:33
|
Revision: 3846
http://openvrml.svn.sourceforge.net/openvrml/?rev=3846&view=rev
Author: braden
Date: 2009-03-19 04:19:27 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Created a convenience library libopenvrml-control to hold the platform-independent parts of the OpenVRML control (which is currently called openvrml-xembed).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/openvrml-xembed/browser.cpp
trunk/src/openvrml-xembed/plugin_streambuf.h
Added Paths:
-----------
trunk/src/libopenvrml-control/
trunk/src/libopenvrml-control/openvrml_control/
trunk/src/libopenvrml-control/openvrml_control/browser.cpp
trunk/src/libopenvrml-control/openvrml_control/browser.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-19 04:07:16 UTC (rev 3845)
+++ trunk/ChangeLog 2009-03-19 04:19:27 UTC (rev 3846)
@@ -1,3 +1,73 @@
+2009-03-19 Braden McDaniel <br...@en...>
+
+ Created a convenience library libopenvrml-control to hold the
+ platform-independent parts of the OpenVRML control (which is
+ currently called openvrml-xembed).
+
+ * src/Makefile.am
+ (noinst_LTLIBRARIES): Added convenience library
+ libopenvrml-control.
+ (libopenvrml_control_libopenvrml_control_la_SOURCES):
+ libopenvrml-control sources.
+ (libopenvrml_control_libopenvrml_control_la_CPPFLAGS):
+ libopenvrml-control CPPFLAGS.
+ (libopenvrml_control_libopenvrml_control_la_LIBADD): Depends on
+ libopenvrml.
+ (openvrml_xembed_openvrml_xembed_CPPFLAGS): Added
+ libopenvrml-control to include path.
+ (openvrml_xembed_openvrml_xembed_LDADD): Depends on
+ libopenvrml-control.
+ * src/libopenvrml-control/openvrml_control/browser.cpp: Added
+ file. openvrml_control::browser encapsulates a browser "control".
+ * src/libopenvrml-control/openvrml_control/browser.h: Added
+ file. openvrml_control::browser encapsulates a browser "control".
+ * src/openvrml-xembed/browser.cpp
+ (resource_fetcher): Moved to
+ src/libopenvrml-control/openvrml_control/browser.cpp.
+ (browser_host_proxy): Added; implements
+ openvrml_control::browser_host.
+ (OpenvrmlXembedBrowserPrivate_): Added browser_control_host_proxy
+ and browser_control; removed resource_fetcher, browser,
+ browser_initialized_mutex, uninitialized_streambuf_map,
+ streambuf_map, initial_stream_reader_thread, got_initial_stream,
+ and browser_initialized. The removed members have been moved
+ to (or have equivalents in) openvrml_control::browser.
+ (initial_stream_reader): Moved to
+ src/libopenvrml-control/openvrml_control/browser.cpp.
+ (openvrml_xembed_browser_constructor(GType, guint,
+ GObjectConstructParam *)): Initialize the browser_control and
+ browser_control_host_proxy members; removed initialization of
+ removed members.
+ (openvrml_xembed_browser_finalize(GObject *)): Removed cleanup of
+ removed members; delete browser_control and
+ browser_control_host_proxy.
+ (openvrml_xembed_browser_new_stream(OpenvrmlXembedStreamClient *,
+ guint64, const char *, const char *, GError **)): Delegate to
+ openvrml_control::browser::new_stream.
+ (openvrml_xembed_browser_destroy_stream(OpenvrmlXembedStreamClient *,
+ guint64, GError **)): Delegate to
+ openvrml_control::browser::destroy_stream.
+ (openvrml_xembed_browser_write(OpenvrmlXembedStreamClient *,
+ guint64, const GArray *, GError **)): Delegate to
+ openvrml_control::browser::write.
+ (load_url): Moved to
+ src/libopenvrml-control/openvrml_control/browser.cpp.
+ (openvrml_xembed_browser_load_url(OpenvrmlXembedBrowser *, const
+ gchar **, const gchar **, GError **)): Delegate to
+ openvrml_control::browser::load_uri.
+ (openvrml_xembed_browser_get_world_url(OpenvrmlXembedBrowser *,
+ GError **)): Delegate to openvrml_control::browser::world_url.
+ (openvrml_xembed_browser_initialized(OpenvrmlXembedBrowser *)):
+ Delegate to openvrml_control::browser::initialized.
+ (browser_listener::do_browser_changed(const
+ openvrml::browser_event &)): Don't set browser_initialized; this
+ is now taken care of inside openvrml_control::browser.
+ (GtkGLViewer::GtkGLViewer(OpenvrmlXembedBrowserPlug &)): Call
+ openvrml_control::browser::viewer.
+ * src/openvrml-xembed/plugin_streambuf.h
+ (openvrml_xembed::plugin_streambuf): Grant friendship to
+ openvrml_control::browser.
+
2009-03-18 Braden McDaniel <br...@en...>
Newer jni.h is more const-correct; play along.
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-03-19 04:07:16 UTC (rev 3845)
+++ trunk/src/Makefile.am 2009-03-19 04:19:27 UTC (rev 3846)
@@ -721,6 +721,7 @@
libopenvrml_gl_libopenvrml_gl_la_LIBADD = libopenvrml/libopenvrml.la
if ENABLE_XEMBED
+noinst_LTLIBRARIES = libopenvrml-control/libopenvrml-control.la
libexec_PROGRAMS = openvrml-xembed/openvrml-xembed
session_bus_servicesdir = $(datadir)/dbus-1/services
session_bus_services_DATA = openvrml-xembed/org.openvrml.BrowserControl.service
@@ -729,8 +730,20 @@
openvrml-xembed/browser-factory-server-glue.h \
openvrml-xembed/browser-host-client-glue.h
endif
+libopenvrml_control_libopenvrml_control_la_SOURCES = \
+ libopenvrml-control/openvrml_control/browser.cpp \
+ libopenvrml-control/openvrml_control/browser.h
+libopenvrml_control_libopenvrml_control_la_CPPFLAGS = \
+ -I$(top_srcdir)/src/openvrml-xembed \
+ -I$(top_builddir)/src/libopenvrml \
+ -I$(top_srcdir)/src/libopenvrml
+libopenvrml_control_libopenvrml_control_la_LIBADD = \
+ libopenvrml/libopenvrml.la
+
openvrml_xembed_openvrml_xembed_CPPFLAGS = \
-I$(top_builddir)/src/openvrml-xembed \
+ -I$(top_srcdir)/src/openvrml-xembed \
+ -I$(top_srcdir)/src/libopenvrml-control \
-I$(top_builddir)/src/libopenvrml \
-I$(top_srcdir)/src/libopenvrml \
-I$(top_builddir)/src/libopenvrml-gl \
@@ -753,6 +766,7 @@
$(DBUS_G_LIBS) \
$(GTKGL_LIBS)
openvrml_xembed_openvrml_xembed_LDADD = \
+ libopenvrml-control/libopenvrml-control.la \
libopenvrml-gl/libopenvrml-gl.la
openvrml_xembed_datadir = $(datadir)/openvrml-xembed
Added: trunk/src/libopenvrml-control/openvrml_control/browser.cpp
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/browser.cpp (rev 0)
+++ trunk/src/libopenvrml-control/openvrml_control/browser.cpp 2009-03-19 04:19:27 UTC (rev 3846)
@@ -0,0 +1,366 @@
+// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
+//
+// OpenVRML Control
+//
+// Copyright 2009 Braden N. McDaniel
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; if not, see <http://www.gnu.org/licenses/>.
+//
+
+# include "browser.h"
+# include <openvrml/browser.h>
+# include <boost/lexical_cast.hpp>
+# include <iostream>
+
+openvrml_control::unknown_stream::unknown_stream(const std::string & uri):
+ std::logic_error("no stream corresponding to URI: " + uri)
+{}
+
+openvrml_control::unknown_stream::unknown_stream(const uint64_t stream_id):
+ std::logic_error("no stream corresponding to stream ID: "
+ + boost::lexical_cast<std::string>(stream_id))
+{}
+
+openvrml_control::unknown_stream::~unknown_stream() throw ()
+{}
+
+openvrml_control::browser::resource_fetcher::
+resource_fetcher(browser_host & control_host,
+ openvrml_xembed::uninitialized_plugin_streambuf_map &
+ uninitialized_plugin_streambuf_map,
+ openvrml_xembed::plugin_streambuf_map & plugin_streambuf_map):
+ control_host_(control_host),
+ uninitialized_plugin_streambuf_map_(uninitialized_plugin_streambuf_map),
+ plugin_streambuf_map_(plugin_streambuf_map)
+{}
+
+openvrml_control::browser::resource_fetcher::~resource_fetcher()
+ OPENVRML_NOTHROW
+{
+ this->thread_group_.join_all();
+}
+
+void
+openvrml_control::browser::resource_fetcher::
+create_thread(const boost::function0<void> & threadfunc)
+{
+ this->thread_group_.create_thread(threadfunc);
+}
+
+std::auto_ptr<openvrml::resource_istream>
+openvrml_control::browser::resource_fetcher::
+do_get_resource(const std::string & uri)
+{
+ using openvrml_xembed::plugin_streambuf;
+
+ class plugin_resource_istream : public openvrml::resource_istream {
+ const boost::shared_ptr<plugin_streambuf> streambuf_;
+ resource_fetcher & resource_fetcher_;
+
+ public:
+ plugin_resource_istream(const std::string & uri,
+ resource_fetcher & fetcher):
+ openvrml::resource_istream(0),
+ streambuf_(
+ new plugin_streambuf(
+ uri,
+ fetcher.uninitialized_plugin_streambuf_map_,
+ fetcher.plugin_streambuf_map_)),
+ resource_fetcher_(fetcher)
+ {
+ this->rdbuf(this->streambuf_.get());
+ fetcher.uninitialized_plugin_streambuf_map_.insert(
+ uri, this->streambuf_);
+
+ //
+ // browser_host::get_url could throw; let it.
+ //
+ const int get_url_result = fetcher.control_host_.get_url(uri);
+
+ if (get_url_result != 0) {
+ this->setstate(ios_base::badbit);
+ }
+ this->streambuf_->set_get_url_result(get_url_result);
+ }
+
+ private:
+ virtual const std::string do_url() const OPENVRML_NOTHROW
+ {
+ return this->streambuf_->url();
+ }
+
+ virtual const std::string do_type() const OPENVRML_NOTHROW
+ {
+ return this->streambuf_->type();
+ }
+
+ virtual bool do_data_available() const OPENVRML_NOTHROW
+ {
+ return this->streambuf_->data_available();
+ }
+ };
+ return std::auto_ptr<openvrml::resource_istream>(
+ new plugin_resource_istream(uri, *this));
+}
+
+openvrml_control::browser::browser_listener::browser_listener(browser & b):
+ browser_(b)
+{}
+
+void
+openvrml_control::browser::browser_listener::
+do_browser_changed(const openvrml::browser_event & event)
+{
+ switch (event.id()) {
+ case openvrml::browser_event::initialized:
+ {
+ boost::mutex::scoped_lock lock(this->browser_.initialized_mutex_);
+ this->browser_.initialized_ = true;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+namespace {
+ //
+ // We don't already know what the URI of the initial stream is until we
+ // start getting that data from the browser. This is a placeholder that
+ // is used to identify the plugin_streambuf that will be used to receive
+ // the initial stream data.
+ //
+ const char initial_stream_uri[] = "x-openvrml-initial:";
+
+ struct OPENVRML_LOCAL initial_stream_reader {
+ initial_stream_reader(
+ const boost::shared_ptr<openvrml_xembed::plugin_streambuf> &
+ streambuf,
+ openvrml::browser & browser):
+ streambuf_(streambuf),
+ browser_(browser)
+ {}
+
+ void operator()() const throw ()
+ {
+ using openvrml_xembed::plugin_streambuf;
+
+ class plugin_istream : public openvrml::resource_istream {
+ boost::shared_ptr<plugin_streambuf> streambuf_;
+
+ public:
+ explicit plugin_istream(
+ const boost::shared_ptr<plugin_streambuf> & streambuf):
+ openvrml::resource_istream(streambuf.get()),
+ streambuf_(streambuf)
+ {}
+
+ virtual ~plugin_istream() throw ()
+ {}
+
+ private:
+ virtual const std::string do_url() const throw (std::bad_alloc)
+ {
+ return this->streambuf_->url();
+ }
+
+ virtual const std::string do_type() const
+ throw (std::bad_alloc)
+ {
+ return this->streambuf_->type();
+ }
+
+ virtual bool do_data_available() const throw ()
+ {
+ return this->streambuf_->data_available();
+ }
+ } in(this->streambuf_);
+
+ this->browser_.set_world(in);
+ }
+
+ private:
+ boost::shared_ptr<openvrml_xembed::plugin_streambuf> streambuf_;
+ openvrml::browser & browser_;
+ };
+}
+
+openvrml_control::browser::browser(browser_host & host,
+ const bool expect_initial_stream):
+ fetcher_(host,
+ this->uninitialized_streambuf_map_,
+ this->streambuf_map_),
+ listener_(*this),
+ browser_(this->fetcher_, std::cout, std::cerr),
+ host_(host),
+ expect_initial_stream_(expect_initial_stream),
+ got_initial_stream_(false)
+{
+ this->browser_.add_listener(this->listener_);
+
+ //
+ // If necessary, create the initial stream.
+ //
+ if (expect_initial_stream) {
+ using boost::function0;
+ using boost::shared_ptr;
+ using openvrml_xembed::plugin_streambuf;
+
+ const shared_ptr<plugin_streambuf> initial_stream(
+ new plugin_streambuf(::initial_stream_uri,
+ this->uninitialized_streambuf_map_,
+ this->streambuf_map_));
+ initial_stream->state_ = plugin_streambuf::uninitialized;
+ this->uninitialized_streambuf_map_.insert(::initial_stream_uri,
+ initial_stream);
+
+ const function0<void> initial_stream_reader_func =
+ initial_stream_reader(initial_stream, this->browser_);
+
+ this->initial_stream_reader_thread_.reset(
+ new boost::thread(initial_stream_reader_func));
+ }
+}
+
+openvrml_control::browser::~browser() OPENVRML_NOTHROW
+{
+ if (this->expect_initial_stream_) {
+ this->initial_stream_reader_thread_->join();
+ }
+ this->browser_.remove_listener(this->listener_);
+}
+
+bool openvrml_control::browser::initialized() const
+{
+ boost::mutex::scoped_lock lock(this->initialized_mutex_);
+ return this->initialized_;
+}
+
+void openvrml_control::browser::new_stream(const uint64_t stream_id,
+ const std::string & type,
+ const std::string & uri)
+ OPENVRML_THROW1(unknown_stream)
+{
+ using namespace openvrml_xembed;
+ using boost::shared_ptr;
+
+ shared_ptr<plugin_streambuf> streambuf =
+ this->uninitialized_streambuf_map_.find(uri);
+
+ if (!streambuf) {
+ if (!this->got_initial_stream_) {
+ assert(this->uninitialized_streambuf_map_.size() == 1);
+ streambuf = this->uninitialized_streambuf_map_.front();
+ this->got_initial_stream_ = true;
+ } else {
+ throw unknown_stream(uri);
+ }
+ }
+ assert(streambuf->state() != plugin_streambuf::initialized);
+ streambuf->init(stream_id, uri, type);
+}
+
+void openvrml_control::browser::destroy_stream(const uint64_t stream_id)
+ OPENVRML_THROW1(unknown_stream)
+{
+ using namespace openvrml_xembed;
+ using boost::shared_ptr;
+
+ const shared_ptr<plugin_streambuf> streambuf =
+ this->streambuf_map_.find(stream_id);
+ if (!streambuf) { throw unknown_stream(stream_id); }
+ streambuf->buf_.set_eof();
+ this->streambuf_map_.erase(stream_id);
+}
+
+void openvrml_control::browser::write(const uint64_t stream_id,
+ const unsigned char * const data,
+ const size_t size)
+ OPENVRML_THROW1(unknown_stream)
+{
+ using namespace openvrml_xembed;
+ using boost::shared_ptr;
+
+ const shared_ptr<plugin_streambuf> streambuf =
+ this->streambuf_map_.find(stream_id);
+ if (!streambuf) { throw unknown_stream(stream_id); }
+ for (size_t i = 0; i < size; ++i) { streambuf->buf_.put(data[i]); }
+}
+
+struct OPENVRML_LOCAL openvrml_control::browser::load_url {
+ load_url(browser & b,
+ const std::vector<std::string> & url,
+ const std::vector<std::string> & parameter):
+ browser_(b),
+ url_(url),
+ parameter_(parameter)
+ {}
+
+ void operator()() const OPENVRML_NOTHROW
+ {
+ try {
+ {
+ boost::mutex::scoped_lock
+ lock(this->browser_.initialized_mutex_);
+ this->browser_.initialized_ = false;
+ }
+ this->browser_.browser_.load_url(this->url_, this->parameter_);
+ } catch (std::exception & ex) {
+ this->browser_.browser_.err(ex.what());
+ }
+ }
+
+ private:
+ browser & browser_;
+ const std::vector<std::string> url_, parameter_;
+};
+
+void
+openvrml_control::browser::load_uri(const std::vector<std::string> & uri,
+ const std::vector<std::string> & parameter)
+ OPENVRML_THROW2(boost::thread_resource_error, std::bad_alloc)
+{
+ this->fetcher_.create_thread(load_url(*this, uri, parameter));
+}
+
+const std::string openvrml_control::browser::world_url()
+{
+ return this->browser_.world_url();
+}
+
+bool
+openvrml_control::browser::add_listener(openvrml::browser_listener & listener)
+{
+ return this->browser_.add_listener(listener);
+}
+
+bool
+openvrml_control::browser::
+remove_listener(openvrml::browser_listener & listener)
+{
+ return this->browser_.remove_listener(listener);
+}
+
+void openvrml_control::browser::viewer(openvrml::viewer * v)
+{
+ this->browser_.viewer(v);
+}
+
+openvrml_control::browser_host::~browser_host()
+{}
+
+int openvrml_control::browser_host::get_url(const std::string & url)
+{
+ this->do_get_url(url);
+}
Property changes on: trunk/src/libopenvrml-control/openvrml_control/browser.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/src/libopenvrml-control/openvrml_control/browser.h
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/browser.h (rev 0)
+++ trunk/src/libopenvrml-control/openvrml_control/browser.h 2009-03-19 04:19:27 UTC (rev 3846)
@@ -0,0 +1,123 @@
+// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
+//
+// OpenVRML Control
+//
+// Copyright 2009 Braden N. McDaniel
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; if not, see <http://www.gnu.org/licenses/>.
+//
+
+# ifndef OPENVRML_CONTROL_BROWSER_H
+# define OPENVRML_CONTROL_BROWSER_H
+
+# include "plugin_streambuf.h"
+# include <openvrml/browser.h>
+
+namespace openvrml_control {
+
+ class unknown_stream : public std::logic_error {
+ public:
+ explicit unknown_stream(const std::string & uri);
+ explicit unknown_stream(uint64_t stream_id);
+ virtual ~unknown_stream() throw ();
+ };
+
+ class browser_host;
+
+ class browser {
+ struct load_url;
+
+ class resource_fetcher : public openvrml::resource_fetcher {
+ browser_host & control_host_;
+ openvrml_xembed::uninitialized_plugin_streambuf_map &
+ uninitialized_plugin_streambuf_map_;
+ openvrml_xembed::plugin_streambuf_map & plugin_streambuf_map_;
+ boost::thread_group thread_group_;
+
+ public:
+ resource_fetcher(
+ browser_host & control_host,
+ openvrml_xembed::uninitialized_plugin_streambuf_map &
+ uninitialized_plugin_streambuf_map,
+ openvrml_xembed::plugin_streambuf_map & plugin_streambuf_map);
+ virtual ~resource_fetcher() OPENVRML_NOTHROW;
+
+ void create_thread(const boost::function0<void> & threadfunc);
+
+ private:
+ virtual std::auto_ptr<openvrml::resource_istream>
+ do_get_resource(const std::string & uri);
+ };
+
+ class browser_listener : public openvrml::browser_listener {
+ browser & browser_;
+
+ public:
+ explicit browser_listener(browser & b);
+
+ private:
+ virtual void
+ do_browser_changed(const openvrml::browser_event & event);
+ };
+
+ openvrml_xembed::uninitialized_plugin_streambuf_map
+ uninitialized_streambuf_map_;
+ openvrml_xembed::plugin_streambuf_map streambuf_map_;
+ resource_fetcher fetcher_;
+ browser_listener listener_;
+ openvrml::browser browser_;
+ browser_host & host_;
+ boost::scoped_ptr<boost::thread> initial_stream_reader_thread_;
+ bool expect_initial_stream_, got_initial_stream_;
+ mutable boost::mutex initialized_mutex_;
+ bool initialized_;
+
+ public:
+ browser(browser_host & host, bool expect_initial_stream);
+ ~browser() OPENVRML_NOTHROW;
+
+ bool initialized() const;
+
+ void new_stream(uint64_t stream_id,
+ const std::string & type, const std::string & uri)
+ OPENVRML_THROW1(unknown_stream);
+ void destroy_stream(uint64_t stream_id)
+ OPENVRML_THROW1(unknown_stream);
+ void write(uint64_t stream_id, const unsigned char * data, size_t size)
+ OPENVRML_THROW1(unknown_stream);
+
+ void load_uri(const std::vector<std::string> & uri,
+ const std::vector<std::string> & parameter)
+ OPENVRML_THROW2(boost::thread_resource_error, std::bad_alloc);
+ const std::string world_url();
+
+ bool add_listener(openvrml::browser_listener & listener);
+ bool remove_listener(openvrml::browser_listener & listener);
+
+ void viewer(openvrml::viewer * v);
+ };
+
+
+ class browser_host {
+ public:
+ virtual ~browser_host() = 0;
+
+ int get_url(const std::string & url);
+
+ private:
+ virtual int do_get_url(const std::string & url) = 0;
+ };
+}
+
+# endif // ifndef OPENVRML_CONTROL_BROWSER_H
Property changes on: trunk/src/libopenvrml-control/openvrml_control/browser.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/src/openvrml-xembed/browser.cpp
===================================================================
--- trunk/src/openvrml-xembed/browser.cpp 2009-03-19 04:07:16 UTC (rev 3845)
+++ trunk/src/openvrml-xembed/browser.cpp 2009-03-19 04:19:27 UTC (rev 3846)
@@ -18,21 +18,17 @@
// with this library; if not, see <http://www.gnu.org/licenses/>.
//
-# include <iostream>
-# include <sstream>
# include <boost/multi_index/detail/scope_guard.hpp>
// Must include before X11 headers.
# include <boost/numeric/conversion/converter.hpp>
-# include <boost/ptr_container/ptr_map.hpp>
# include <X11/keysym.h>
# include <dbus/dbus-glib.h>
# include <gdk/gdkx.h>
-# include <openvrml/browser.h>
+# include <openvrml_control/browser.h>
# include <openvrml/gl/viewer.h>
# include "browser.h"
# include "browser-server-glue.h"
# include "browser-host-client-glue.h"
-# include "plugin_streambuf.h"
# include <gtk/gtkgl.h>
# include <gtk/gtkdrawingarea.h>
@@ -73,54 +69,59 @@
openvrml_xembed_browser_stream_client_interface_init))
namespace {
- class G_GNUC_INTERNAL resource_fetcher : public openvrml::resource_fetcher {
- DBusGProxy & control_host_;
- openvrml_xembed::uninitialized_plugin_streambuf_map &
- uninitialized_plugin_streambuf_map_;
- openvrml_xembed::plugin_streambuf_map & plugin_streambuf_map_;
- boost::thread_group thread_group_;
+ class G_GNUC_INTERNAL browser_listener : public openvrml::browser_listener {
+ OpenvrmlXembedBrowser & browser_;
+
public:
- resource_fetcher(
- DBusGProxy & control_host,
- openvrml_xembed::uninitialized_plugin_streambuf_map &
- uninitialized_plugin_streambuf_map,
- openvrml_xembed::plugin_streambuf_map & plugin_streambuf_map);
- virtual ~resource_fetcher() OPENVRML_NOTHROW;
+ explicit browser_listener(OpenvrmlXembedBrowser & browser);
- void create_thread(const boost::function0<void> & threadfunc);
-
private:
- virtual std::auto_ptr<openvrml::resource_istream>
- do_get_resource(const std::string & uri);
+ virtual void do_browser_changed(const openvrml::browser_event & event);
};
- class G_GNUC_INTERNAL browser_listener : public openvrml::browser_listener {
- OpenvrmlXembedBrowser & browser_;
+ class G_GNUC_INTERNAL browser_host_proxy :
+ public openvrml_control::browser_host {
+
+ DBusGProxy & host_;
+
public:
- explicit browser_listener(OpenvrmlXembedBrowser & browser);
+ explicit browser_host_proxy(DBusGProxy & host):
+ host_(host)
+ {}
private:
- virtual void do_browser_changed(const openvrml::browser_event & event);
+ virtual int do_get_url(const std::string & url)
+ {
+ GError * error = 0;
+ scope_guard error_guard = make_guard(g_error_free, boost::ref(error));
+ gint result = -1;
+ gboolean succeeded =
+ org_openvrml_BrowserHost_get_url(&this->host_,
+ url.c_str(),
+ &result,
+ &error);
+ if (!succeeded) {
+ throw std::invalid_argument(error->message);
+ }
+
+ error_guard.dismiss();
+
+ return result;
+ }
};
}
struct OpenvrmlXembedBrowserPrivate_ {
DBusGProxy * control_host;
- ::resource_fetcher * resource_fetcher;
- openvrml::browser * browser;
+ browser_host_proxy * browser_control_host_proxy;
+ openvrml_control::browser * browser_control;
browser_listener * listener;
OpenvrmlXembedBrowserPlug * browser_plug;
GMutex * browser_plug_mutex;
GCond * browser_plug_set_cond;
- GMutex * browser_initialized_mutex;
- openvrml_xembed::uninitialized_plugin_streambuf_map * uninitialized_streambuf_map;
- openvrml_xembed::plugin_streambuf_map * streambuf_map;
- boost::thread * initial_stream_reader_thread;
bool expect_initial_stream;
- bool got_initial_stream;
- bool browser_initialized;
};
# define OPENVRML_XEMBED_BROWSER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), OPENVRML_XEMBED_TYPE_BROWSER, OpenvrmlXembedBrowserPrivate))
@@ -207,68 +208,6 @@
&dbus_glib_openvrml_xembed_browser_object_info);
}
-namespace {
- //
- // We don't already know what the URI of the initial stream is until we
- // start getting that data from the browser. This is a placeholder that
- // is used to identify the plugin_streambuf that will be used to receive
- // the initial stream data.
- //
- const char initial_stream_uri[] = "x-openvrml-initial:";
-
- struct OPENVRML_LOCAL initial_stream_reader {
- initial_stream_reader(
- const boost::shared_ptr<openvrml_xembed::plugin_streambuf> &
- streambuf,
- openvrml::browser & browser):
- streambuf_(streambuf),
- browser_(browser)
- {}
-
- void operator()() const throw ()
- {
- using openvrml_xembed::plugin_streambuf;
-
- class plugin_istream : public openvrml::resource_istream {
- boost::shared_ptr<plugin_streambuf> streambuf_;
-
- public:
- explicit plugin_istream(
- const boost::shared_ptr<plugin_streambuf> & streambuf):
- openvrml::resource_istream(streambuf.get()),
- streambuf_(streambuf)
- {}
-
- virtual ~plugin_istream() throw ()
- {}
-
- private:
- virtual const std::string do_url() const throw (std::bad_alloc)
- {
- return this->streambuf_->url();
- }
-
- virtual const std::string do_type() const
- throw (std::bad_alloc)
- {
- return this->streambuf_->type();
- }
-
- virtual bool do_data_available() const throw ()
- {
- return this->streambuf_->data_available();
- }
- } in(this->streambuf_);
-
- this->browser_.set_world(in);
- }
-
- private:
- boost::shared_ptr<openvrml_xembed::plugin_streambuf> streambuf_;
- openvrml::browser & browser_;
- };
-}
-
GObject *
openvrml_xembed_browser_constructor(
GType type,
@@ -289,54 +228,21 @@
try {
OpenvrmlXembedBrowser * const browser = OPENVRML_XEMBED_BROWSER(obj);
- browser->priv->uninitialized_streambuf_map =
- new openvrml_xembed::uninitialized_plugin_streambuf_map;
- browser->priv->streambuf_map =
- new openvrml_xembed::plugin_streambuf_map;
- browser->priv->resource_fetcher =
- new resource_fetcher(*browser->priv->control_host,
- *browser->priv->uninitialized_streambuf_map,
- *browser->priv->streambuf_map);
- browser->priv->browser =
- new openvrml::browser(*browser->priv->resource_fetcher,
- std::cout,
- std::cerr);
+ browser->priv->browser_control_host_proxy =
+ new browser_host_proxy(*browser->priv->control_host);
+ browser->priv->browser_control =
+ new openvrml_control::browser(
+ *browser->priv->browser_control_host_proxy,
+ browser->priv->expect_initial_stream);
browser->priv->listener = new browser_listener(*browser);
- browser->priv->browser->add_listener(*browser->priv->listener);
+ browser->priv->browser_control->add_listener(*browser->priv->listener);
browser->priv->browser_plug = 0;
browser->priv->browser_plug_mutex = g_mutex_new();
browser->priv->browser_plug_set_cond = g_cond_new();
-
- browser->priv->browser_initialized = false;
- browser->priv->browser_initialized_mutex = g_mutex_new();
-
- //
- // If necessary, create the initial stream.
- //
- if (browser->priv->expect_initial_stream) {
- using boost::function0;
- using boost::shared_ptr;
- using openvrml_xembed::plugin_streambuf;
-
- const shared_ptr<plugin_streambuf> initial_stream(
- new plugin_streambuf(
- ::initial_stream_uri,
- *browser->priv->uninitialized_streambuf_map,
- *browser->priv->streambuf_map));
- initial_stream->state_ = plugin_streambuf::uninitialized;
- browser->priv->uninitialized_streambuf_map
- ->insert(::initial_stream_uri, initial_stream);
-
- const function0<void> initial_stream_reader_func =
- initial_stream_reader(initial_stream, *browser->priv->browser);
-
- browser->priv->initial_stream_reader_thread =
- new boost::thread(initial_stream_reader_func);
- }
} catch (std::exception & ex) {
//
- // ex is most likely std::bad_alloc or boost::thread_resource_error.
+ // ex is most likely std::bad_alloc.
//
g_critical("%s", ex.what());
return 0;
@@ -347,21 +253,12 @@
void openvrml_xembed_browser_finalize(GObject * const obj)
{
OpenvrmlXembedBrowser * const browser = OPENVRML_XEMBED_BROWSER(obj);
-
- if (browser->priv->expect_initial_stream) {
- browser->priv->initial_stream_reader_thread->join();
- delete browser->priv->initial_stream_reader_thread;
- }
-
- g_mutex_free(browser->priv->browser_initialized_mutex);
g_cond_free(browser->priv->browser_plug_set_cond);
g_mutex_free(browser->priv->browser_plug_mutex);
- browser->priv->browser->remove_listener(*browser->priv->listener);
+ browser->priv->browser_control->remove_listener(*browser->priv->listener);
delete browser->priv->listener;
- delete browser->priv->browser;
- delete browser->priv->resource_fetcher;
- delete browser->priv->streambuf_map;
- delete browser->priv->uninitialized_streambuf_map;
+ delete browser->priv->browser_control;
+ delete browser->priv->browser_control_host_proxy;
}
void openvrml_xembed_browser_set_property(GObject * const obj,
@@ -458,28 +355,15 @@
OpenvrmlXembedBrowser * const browser =
OPENVRML_XEMBED_BROWSER(stream_client);
- shared_ptr<plugin_streambuf> streambuf =
- browser->priv->uninitialized_streambuf_map->find(url);
-
- if (!streambuf) {
- if (!browser->priv->got_initial_stream) {
- g_assert(
- browser->priv->uninitialized_streambuf_map->size() == 1);
- streambuf =
- browser->priv->uninitialized_streambuf_map->front();
- browser->priv->got_initial_stream = true;
- } else {
- g_set_error(
- error,
- OPENVRML_XEMBED_ERROR,
- OPENVRML_XEMBED_ERROR_UNKNOWN_STREAM,
- "Attempt to create a stream that has not been requested: %s",
- url);
- return false;
- }
+ try {
+ browser->priv->browser_control->new_stream(stream_id, type, url);
+ } catch (const openvrml_control::unknown_stream & ex) {
+ g_set_error(error,
+ OPENVRML_XEMBED_ERROR,
+ OPENVRML_XEMBED_ERROR_UNKNOWN_STREAM,
+ ex.what());
+ return false;
}
- g_assert(streambuf->state() != plugin_streambuf::initialized);
- streambuf->init(stream_id, url, type);
return true;
}
@@ -495,19 +379,15 @@
OpenvrmlXembedBrowser * const browser =
OPENVRML_XEMBED_BROWSER(stream_client);
- const shared_ptr<plugin_streambuf> streambuf =
- browser->priv->streambuf_map->find(stream_id);
- if (!streambuf) {
- g_set_error(
- error,
- OPENVRML_XEMBED_ERROR,
- OPENVRML_XEMBED_ERROR_UNKNOWN_STREAM,
- "Attempt to destroy a nonexistent stream: %lu",
- stream_id);
+ try {
+ browser->priv->browser_control->destroy_stream(stream_id);
+ } catch (const openvrml_control::unknown_stream & ex) {
+ g_set_error(error,
+ OPENVRML_XEMBED_ERROR,
+ OPENVRML_XEMBED_ERROR_UNKNOWN_STREAM,
+ ex.what());
return false;
}
- streambuf->buf_.set_eof();
- browser->priv->streambuf_map->erase(stream_id);
return true;
}
@@ -523,52 +403,20 @@
OpenvrmlXembedBrowser * const browser =
OPENVRML_XEMBED_BROWSER(stream_client);
- const shared_ptr<plugin_streambuf> streambuf =
- browser->priv->streambuf_map->find(stream_id);
- if (!streambuf) {
- g_set_error(
- error,
- OPENVRML_XEMBED_ERROR,
- OPENVRML_XEMBED_ERROR_UNKNOWN_STREAM,
- "Attempt to write to a nonexistent stream: %lu",
- stream_id);
- return false;
+ try {
+ browser->priv->browser_control->write(
+ stream_id,
+ reinterpret_cast<unsigned char *>(data->data),
+ data->len);
+ } catch (const openvrml_control::unknown_stream & ex) {
+ g_set_error(error,
+ OPENVRML_XEMBED_ERROR,
+ OPENVRML_XEMBED_ERROR_UNKNOWN_STREAM,
+ ex.what());
}
- for (size_t i = 0; i < data->len; ++i) {
- streambuf->buf_.put(g_array_index(data, unsigned char, i));
- }
return true;
}
-namespace {
- struct G_GNUC_INTERNAL load_url {
- load_url(OpenvrmlXembedBrowser & browser,
- const std::vector<std::string> & url,
- const std::vector<std::string> & parameter):
- browser_(browser),
- url_(url),
- parameter_(parameter)
- {}
-
- void operator()() const OPENVRML_NOTHROW
- {
- try {
- g_mutex_lock(this->browser_.priv->browser_initialized_mutex);
- this->browser_.priv->browser_initialized = false;
- g_mutex_unlock(this->browser_.priv->browser_initialized_mutex);
- this->browser_.priv->browser->load_url(this->url_,
- this->parameter_);
- } catch (std::exception & ex) {
- this->browser_.priv->browser->err(ex.what());
- }
- }
-
- private:
- OpenvrmlXembedBrowser & browser_;
- const std::vector<std::string> url_, parameter_;
- };
-}
-
gboolean
openvrml_xembed_browser_load_url(OpenvrmlXembedBrowser * const vrml_browser,
const gchar ** url,
@@ -583,8 +431,7 @@
while (url && *url) { url_vec.push_back(*(url++)); }
while (parameter && *parameter) { param_vec.push_back(*(parameter++)); }
- vrml_browser->priv->resource_fetcher
- ->create_thread(load_url(*vrml_browser, url_vec, param_vec));
+ vrml_browser->priv->browser_control->load_uri(url_vec, param_vec);
} catch (const std::bad_alloc & ex) {
*error = g_error_new(OPENVRML_XEMBED_ERROR,
OPENVRML_XEMBED_ERROR_NO_MEMORY,
@@ -653,19 +500,16 @@
gchar *
openvrml_xembed_browser_get_world_url(
- OpenvrmlXembedBrowser * const vrml_browser,
+ OpenvrmlXembedBrowser * const browser,
GError ** /* error */)
{
- return g_strdup(vrml_browser->priv->browser->world_url().c_str());
+ return g_strdup(browser->priv->browser_control->world_url().c_str());
}
gboolean
openvrml_xembed_browser_initialized(OpenvrmlXembedBrowser * const browser)
{
- g_mutex_lock(browser->priv->browser_initialized_mutex);
- const bool browser_initialized = browser->priv->browser_initialized;
- g_mutex_unlock(browser->priv->browser_initialized_mutex);
- return browser_initialized;
+ return browser->priv->browser_control->initialized();
}
@@ -1249,104 +1093,6 @@
namespace {
- resource_fetcher::resource_fetcher(
- DBusGProxy & control_host,
- openvrml_xembed::uninitialized_plugin_streambuf_map &
- uninitialized_plugin_streambuf_map,
- openvrml_xembed::plugin_streambuf_map & plugin_streambuf_map):
- control_host_(control_host),
- uninitialized_plugin_streambuf_map_(uninitialized_plugin_streambuf_map),
- plugin_streambuf_map_(plugin_streambuf_map)
- {}
-
- resource_fetcher::~resource_fetcher() OPENVRML_NOTHROW
- {
- this->thread_group_.join_all();
- }
-
- void
- resource_fetcher::create_thread(const boost::function0<void> & threadfunc)
- {
- this->thread_group_.create_thread(threadfunc);
- }
-
- std::auto_ptr<openvrml::resource_istream>
- resource_fetcher::do_get_resource(const std::string & uri)
- {
- using openvrml_xembed::plugin_streambuf;
-
- class plugin_resource_istream : public openvrml::resource_istream {
- const boost::shared_ptr<plugin_streambuf> streambuf_;
- resource_fetcher & resource_fetcher_;
-
- public:
- plugin_resource_istream(const std::string & uri,
- resource_fetcher & fetcher):
- openvrml::resource_istream(0),
- streambuf_(
- new plugin_streambuf(
- uri,
- fetcher.uninitialized_plugin_streambuf_map_,
- fetcher.plugin_streambuf_map_)),
- resource_fetcher_(fetcher)
- {
- using std::ostringstream;
- using boost::ref;
-
- this->rdbuf(this->streambuf_.get());
- fetcher.uninitialized_plugin_streambuf_map_
- .insert(uri, this->streambuf_);
-
- //
- // We're in a thread started by libopenvrml here. By using
- // dbus_g_proxy_begin_call here (instead of dbus_g_proxy_call),
- // we finish the call in the main thread. That's important
- // because we want to make sure this call "finishes" before
- // we execute the host's successive NewStream call.
- //
- GError * error = 0;
- scope_guard error_guard = make_guard(g_error_free,
- boost::ref(error));
- gint get_url_result = -1;
- gboolean succeeded =
- org_openvrml_BrowserHost_get_url(&fetcher.control_host_,
- uri.c_str(),
- &get_url_result,
- &error);
- if (!succeeded) {
- g_critical(error->message);
- this->setstate(ios_base::badbit);
- return;
- }
-
- if (get_url_result != 0) {
- this->setstate(ios_base::badbit);
- }
- this->streambuf_->set_get_url_result(get_url_result);
-
- error_guard.dismiss();
- }
-
- private:
- virtual const std::string do_url() const throw ()
- {
- return this->streambuf_->url();
- }
-
- virtual const std::string do_type() const throw ()
- {
- return this->streambuf_->type();
- }
-
- virtual bool do_data_available() const throw ()
- {
- return this->streambuf_->data_available();
- }
- };
- return std::auto_ptr<openvrml::resource_istream>(
- new plugin_resource_istream(uri, *this));
- }
-
browser_listener::browser_listener(OpenvrmlXembedBrowser & browser):
browser_(browser)
{}
@@ -1357,10 +1103,6 @@
switch (event.id()) {
case openvrml::browser_event::initialized:
g_signal_emit(&this->browser_, signals[initialized_id], 0);
-
- g_mutex_lock(this->browser_.priv->browser_initialized_mutex);
- this->browser_.priv->browser_initialized = true;
- g_mutex_unlock(this->browser_.priv->browser_initialized_mutex);
break;
case openvrml::browser_event::shutdown:
g_signal_emit(&this->browser_, signals[shutdown_id], 0);
@@ -1374,7 +1116,7 @@
browser_plug_(browser_plug),
timer(0)
{
- this->browser_plug_.priv->browser->priv->browser->viewer(this);
+ this->browser_plug_.priv->browser->priv->browser_control->viewer(this);
}
GtkGLViewer::~GtkGLViewer() throw ()
Modified: trunk/src/openvrml-xembed/plugin_streambuf.h
===================================================================
--- trunk/src/openvrml-xembed/plugin_streambuf.h 2009-03-19 04:07:16 UTC (rev 3845)
+++ trunk/src/openvrml-xembed/plugin_streambuf.h 2009-03-19 04:19:27 UTC (rev 3846)
@@ -28,8 +28,11 @@
# include <boost/enable_shared_from_this.hpp>
# include <openvrml/read_write_mutex.h>
# include "bounded_buffer.h"
-# include "browser.h"
+namespace openvrml_control {
+ class browser;
+}
+
namespace openvrml_xembed {
//
@@ -86,20 +89,7 @@
public boost::enable_shared_from_this<plugin_streambuf>,
public std::streambuf {
- friend
- GObject *
- (::openvrml_xembed_browser_constructor)(
- GType type,
- guint n_construct_properties,
- GObjectConstructParam * construct_properties);
- friend
- gboolean
- (::openvrml_xembed_browser_destroy_stream)(OpenvrmlXembedStreamClient *,
- guint64, GError **);
- friend
- gboolean
- (::openvrml_xembed_browser_write)(OpenvrmlXembedStreamClient *, guint64,
- const GArray *, GError **);
+ friend class openvrml_control::browser;
public:
enum state_id {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-19 04:07:25
|
Revision: 3845
http://openvrml.svn.sourceforge.net/openvrml/?rev=3845&view=rev
Author: braden
Date: 2009-03-19 04:07:16 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Newer jni.h is more const-correct; play along.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/script/java.cpp
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-19 01:31:51 UTC (rev 3844)
+++ trunk/ChangeLog 2009-03-19 04:07:16 UTC (rev 3845)
@@ -1,5 +1,15 @@
2009-03-18 Braden McDaniel <br...@en...>
+ Newer jni.h is more const-correct; play along.
+
+ * src/script/java.cpp
+ (set_array_region_t<jfloat>::value): Added "const" for consistency
+ with newer jni.h.
+ (set_array_region_t<jdouble>::value): Added "const" for consistency
+ with newer jni.h.
+
+2009-03-18 Braden McDaniel <br...@en...>
+
* src/libopenvrml/openvrml/local/parse_vrml.h: Fixes to build with
gcc 4.0 (on Mac OS X 10.5). This compiler appears to have some
bugs with access rules and inner classes; interjecting some
Modified: trunk/src/script/java.cpp
===================================================================
--- trunk/src/script/java.cpp 2009-03-19 01:31:51 UTC (rev 3844)
+++ trunk/src/script/java.cpp 2009-03-19 04:07:16 UTC (rev 3845)
@@ -4491,20 +4491,20 @@
template <> struct set_array_region_t<jfloat> {
static void (JNIEnv::* const value)(
- array_type<jfloat>::type, jsize, jsize, jfloat *);
+ array_type<jfloat>::type, jsize, jsize, const jfloat *);
};
void (JNIEnv::* const set_array_region_t<jfloat>::value)(
- array_type<jfloat>::type, jsize, jsize, jfloat *) =
+ array_type<jfloat>::type, jsize, jsize, const jfloat *) =
&JNIEnv::SetFloatArrayRegion;
template <> struct set_array_region_t<jdouble> {
static void (JNIEnv::* const value)(
- array_type<jdouble>::type, jsize, jsize, jdouble *);
+ array_type<jdouble>::type, jsize, jsize, const jdouble *);
};
void (JNIEnv::* const set_array_region_t<jdouble>::value)(
- array_type<jdouble>::type, jsize, jsize, jdouble *) =
+ array_type<jdouble>::type, jsize, jsize, const jdouble *) =
&JNIEnv::SetDoubleArrayRegion;
template <typename T>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-19 02:22:12
|
Revision: 3844
http://openvrml.svn.sourceforge.net/openvrml/?rev=3844&view=rev
Author: braden
Date: 2009-03-19 01:31:51 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Removed crufty -I$(mozincludedir).
Modified Paths:
--------------
trunk/ChangeLog
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-18 21:23:03 UTC (rev 3843)
+++ trunk/ChangeLog 2009-03-19 01:31:51 UTC (rev 3844)
@@ -7,6 +7,12 @@
2009-03-17 Braden McDaniel <br...@en...>
+ * src/Makefile.am
+ (openvrml_xembed_openvrml_xembed_CPPFLAGS): Removed crufty
+ -I$(mozincludedir).
+
+2009-03-17 Braden McDaniel <br...@en...>
+
Rely on an installed GtkGLExt.
* Makefile.am
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-18 21:23:14
|
Revision: 3843
http://openvrml.svn.sourceforge.net/openvrml/?rev=3843&view=rev
Author: braden
Date: 2009-03-18 21:23:03 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
Fixes to build with gcc 4.0 (on Mac OS X 10.5). This compiler appears to have some bugs with access rules and inner classes; interjecting some forwarding functions works around the problem.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/libopenvrml/openvrml/local/parse_vrml.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-18 03:49:02 UTC (rev 3842)
+++ trunk/ChangeLog 2009-03-18 21:23:03 UTC (rev 3843)
@@ -1,3 +1,10 @@
+2009-03-18 Braden McDaniel <br...@en...>
+
+ * src/libopenvrml/openvrml/local/parse_vrml.h: Fixes to build with
+ gcc 4.0 (on Mac OS X 10.5). This compiler appears to have some
+ bugs with access rules and inner classes; interjecting some
+ forwarding functions works around the problem.
+
2009-03-17 Braden McDaniel <br...@en...>
Rely on an installed GtkGLExt.
Modified: trunk/src/libopenvrml/openvrml/local/parse_vrml.h
===================================================================
--- trunk/src/libopenvrml/openvrml/local/parse_vrml.h 2009-03-18 03:49:02 UTC (rev 3842)
+++ trunk/src/libopenvrml/openvrml/local/parse_vrml.h 2009-03-18 21:23:03 UTC (rev 3843)
@@ -150,6 +150,11 @@
vrml97_parse_actions & actions_;
} on_scene_finish;
+ static boost::thread_group & get_load_proto_thread_group(browser & b)
+ {
+ return b.load_proto_thread_group_;
+ }
+
struct on_externproto_t {
explicit on_externproto_t(vrml97_parse_actions & actions):
actions_(actions)
@@ -209,8 +214,8 @@
metatype_id,
this->actions_.scene_,
uri_list,
- this->actions_.scene_.browser()
- .load_proto_thread_group_));
+ get_load_proto_thread_group(
+ this->actions_.scene_.browser())));
this->actions_.scene_.browser().add_node_metatype(
externproto_class->id(),
@@ -534,6 +539,11 @@
vrml97_parse_actions & actions_;
} on_node_start;
+ static script_node_metatype & get_script_node_metatype(browser & b)
+ {
+ return b.script_node_metatype_;
+ }
+
struct on_node_finish_t {
explicit on_node_finish_t(vrml97_parse_actions & actions):
actions_(actions)
@@ -554,7 +564,8 @@
? nd.type->create_node(ps.scope, nd.initial_values)
: intrusive_ptr<node>(
new script_node(
- this->actions_.scene_.browser().script_node_metatype_,
+ get_script_node_metatype(
+ this->actions_.scene_.browser()),
ps.scope,
nd.script_interfaces,
nd.initial_values));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-03-18 03:49:16
|
Revision: 3842
http://openvrml.svn.sourceforge.net/openvrml/?rev=3842&view=rev
Author: braden
Date: 2009-03-18 03:49:02 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
Removed crufty -I.
Modified Paths:
--------------
trunk/src/Makefile.am
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-03-18 03:24:04 UTC (rev 3841)
+++ trunk/src/Makefile.am 2009-03-18 03:49:02 UTC (rev 3842)
@@ -735,7 +735,6 @@
-I$(top_srcdir)/src/libopenvrml \
-I$(top_builddir)/src/libopenvrml-gl \
-I$(top_srcdir)/src/libopenvrml-gl \
- -I$(mozincludedir) \
-DGTK_DISABLE_DEPRECATED
openvrml_xembed_openvrml_xembed_CXXFLAGS = \
$(PTHREAD_CFLAGS) \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|