Mercurial > hg > orthanc-stone
diff Framework/Viewport/WebGLViewportsRegistry.h @ 1331:ab81ee8fce1f broker
- Viewport is not passed and stored as a shared_ptr instead
of raw reference.
- ViewportController can now be injected with an undo
stack (not a ctor param anymore, as a preparation for the
move of the undo stack to an interactor)
- Added (temp) flag to disable emscripten events registration
in the WebAssemblyViewport (because legacy client code
deals with them directly)
- Added emscripten_clear_timeout in ~WebGLViewportsRegistry
- Removed GenericToolbox::HoldingRef whose responsibility is
better served with proper callback un-registration.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 30 Mar 2020 14:23:46 +0200 |
parents | c38c89684d83 |
children |
line wrap: on
line diff
--- a/Framework/Viewport/WebGLViewportsRegistry.h Mon Mar 30 08:47:30 2020 +0200 +++ b/Framework/Viewport/WebGLViewportsRegistry.h Mon Mar 30 14:23:46 2020 +0200 @@ -23,6 +23,8 @@ #include "WebGLViewport.h" +#include <boost/enable_shared_from_this.hpp> + namespace OrthancStone { /** @@ -33,13 +35,15 @@ * lost). If some WebGL context is lost, it is automatically * reinitialized by created a fresh HTML5 canvas. **/ - class WebGLViewportsRegistry : public boost::noncopyable + class WebGLViewportsRegistry : public boost::noncopyable, + public boost::enable_shared_from_this<WebGLViewportsRegistry> { private: typedef std::map<std::string, boost::shared_ptr<WebGLViewport> > Viewports; double timeoutMS_; Viewports viewports_; + long timeOutID_; void LaunchTimer(); @@ -50,10 +54,7 @@ public: WebGLViewportsRegistry(double timeoutMS /* in milliseconds */); - ~WebGLViewportsRegistry() - { - Clear(); - } + ~WebGLViewportsRegistry(); boost::shared_ptr<WebGLViewport> Add(const std::string& canvasId); @@ -64,7 +65,7 @@ class Accessor : public boost::noncopyable { private: - WebGLViewportsRegistry& that_; + WebGLViewportsRegistry& that_; std::unique_ptr<IViewport::ILock> lock_; public: