view Platforms/Wasm/WasmDelayedCallExecutor.cpp @ 700:059e1fd05fd6 refactor-viewport-controller

Introduced the ViewportController that sits between the application and the Scene2D to handle the trackers and measuring tools. This is a work in progress. The Scene2D is no longer an observable. Message sending is managed by the ViewportController. Move some refs to shared and weak to prevent lifetime issues.
author Benjamin Golinvaux <bgo@osimis.io>
date Sun, 19 May 2019 16:26:17 +0200
parents 26b90b110719
children 4f2416d519b4
line wrap: on
line source

#include "WasmDelayedCallExecutor.h"
#include "json/value.h"
#include "json/writer.h"
#include <emscripten/emscripten.h>

#ifdef __cplusplus
extern "C" {
#endif

  extern void WasmDelayedCallExecutor_Schedule(void* callable,
                                      unsigned int timeoutInMs
                                      /*void* payload*/);

  void EMSCRIPTEN_KEEPALIVE WasmDelayedCallExecutor_ExecuteCallback(void* callable
                                                       //void* payload
                                                       )
  {
    if (callable == NULL)
    {
      throw;
    }
    else
    {
      reinterpret_cast<OrthancStone::MessageHandler<OrthancStone::IDelayedCallExecutor::TimeoutMessage>*>(callable)->
        Apply(OrthancStone::IDelayedCallExecutor::TimeoutMessage()); // uri, reinterpret_cast<Orthanc::IDynamicObject*>(payload)));
    }
  }


#ifdef __cplusplus
}
#endif



namespace OrthancStone
{
  MessageBroker* WasmDelayedCallExecutor::broker_ = NULL;


  void WasmDelayedCallExecutor::Schedule(MessageHandler<IDelayedCallExecutor::TimeoutMessage>* callback,
                         unsigned int timeoutInMs)
  {
    WasmDelayedCallExecutor_Schedule(callback, timeoutInMs);
  }
}