Skip to content

Commit

Permalink
[webview_flutter_lwe] Update lwe (1.3.0)
Browse files Browse the repository at this point in the history
Signed-off-by: Byun MuHong <[email protected]>
  • Loading branch information
bwikbs committed Sep 6, 2024
1 parent 4902ba4 commit 6bbc3e7
Show file tree
Hide file tree
Showing 25 changed files with 117 additions and 53 deletions.
21 changes: 13 additions & 8 deletions packages/webview_flutter_lwe/tizen/inc/lwe/LWEWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,30 @@ namespace LWE {
*/
class LWE_EXPORT LWE {
public:
/**
* \brief Sets the preference for the engine version to be used.
*
* \param preferUpdatedVersion If true, an updated engine version will be
* used if available.
*
* \remark Must be called before the Initialize.
*/
static void SetVersionPreference(bool preferUpdatedVersion);

/**
* \brief Initialize a lightweight web engine.
* It performs tasks (thread initialization, GC preparation) necessary for
* the operation of a lightweight web engine. You must call Initialize
* function before using WebContainer or WebView
*
* \code{.cpp}
* LWE::LWE::Initialize("/tmp/Starfish_localStorage.txt",
* "/tmp/Starfish_Cookies.txt", "/tmp/Starfish-cache");
* LWE::LWE::Initialize("/tmp/Starfish_storage");
* \endcode
*
* \param localStorageDataFilePath File path for local storage.
* \param cookieStoreDataFilePath File path for cookie storage.
* \param httpCacheDataDirectorypath Directory path for http cache.
* \param storageDirectoryPath Directory path for storage.
*
*/
static void Initialize(const char* localStorageDataFilePath,
const char* cookieStoreDataFilePath,
const char* httpCacheDataDirectorypath);
static void Initialize(const char* storageDirectoryPath);

/**
* \brief Returns the initialization status of lightweight web engine.
Expand Down
136 changes: 100 additions & 36 deletions packages/webview_flutter_lwe/tizen/inc/lwe/LWEWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,66 +33,130 @@

namespace LWE {

class LWE_EXPORT WorkerClient {
public:
/*
* Register worker data directory path.
*
* Be sure to set the same data path as the shared or service worker server.
* If you do not register data directory, the data directory path is
* set to '${HOME}/starfish-worker-data' or /tmp/starfish-worker-data.
*
* This method must be invoked after LWE::Initialize() is invoked.
*/
static void RegisterDataDirectoryPath(const std::string &dataDirectoryPath);

/*
* Register service worker server process executor callback function.
* The callback function should return the success or failure of the
* processor execution.
*
* This method must be invoked after LWE::Initialize() is invoked.
*/
static void RegisterServiceWorkerProcessExecutor(
const std::function<bool()> &fn);
};

enum class LWE_EXPORT WorkerProcessState {
None,
Terminated,
};

/**
* \brief Perform initialization or cleanup of service worker.
*/
class LWE_EXPORT ServiceWorker {
public:
/*
* Initialize service worker server.
/**
* \brief Sets the preference for the engine version to be used.
*
* Be sure to set the same data path as the worker client.
* If you set data directory path to an empty path, it is set to
* '${HOME}/starfish-worker-data' or /tmp/starfish-worker-data.
* \param preferUpdatedVersion If true, an updated engine version will be
* used if available.
*
* \remark Must be called before the Initialize.
*/
static void Initialize(const std::string &dataDirectoryPath);
static void SetVersionPreference(bool preferUpdatedVersion);

/**
* \brief Initialize service worker server.
* Be sure to set the same data path as the lightweight web engine.
*
* \code{.cpp}
* LWE::ServiceWorker::Initialize("/tmp/Starfish_storage");
* \endcode
*
* \param storageDirectoryPath Directory path for storage.
*
*/
static void Initialize(const std::string &storageDirectoryPath);

/**
* \brief Register callback that is called when the worker process state
* changes.
*
* \code{.cpp}
* LWE::ServiceWorker::RegisterOnStatusChangedHandler(
* [](LWE::WorkerProcessState state) {
* if (state == LWE::WorkerProcessState::Terminated) {
* printf("Terminated worker process\n");
* }
* }
* );
* \endcode
*
* \param cb state handling callback.
*
*/
static void RegisterOnStatusChangedHandler(
const std::function<void(WorkerProcessState)> &cb);

/**
* \brief Perform lightweight web engine service worker cleanup.
* Called once when the lightweight web engine service worker is no longer
* in use.
*
* \code{.cpp}
* LWE::ServiceWorker::Finalize();
* \endcode
*
*/
static void Finalize();
};

/**
* \brief Perform initialization or cleanup of Shared worker.
*/
class LWE_EXPORT SharedWorker {
public:
/*
* Initialize shared worker server.
/**
* \brief Sets the preference for the engine version to be used.
*
* \param preferUpdatedVersion If true, an updated engine version will be
* used if available.
*
* \remark Must be called before the Initialize.
*/
static void SetVersionPreference(bool preferUpdatedVersion);

/**
* \brief Initialize shared worker server.
* Be sure to set the same data path as the lightweight web engine.
*
* \code{.cpp}
* LWE::SharedWorker::Initialize("/tmp/Starfish_storage");
* \endcode
*
* \param storageDirectoryPath Directory path for storage.
*
* Be sure to set the same data path as the worker client.
* If you set data directory path to an empty path, it is set to
* '${HOME}/starfish-worker-data' or /tmp/starfish-worker-data.
*/
static void Initialize(const std::string &dataDirectoryPath);
static void Initialize(const std::string &storageDirectoryPath);

/**
* \brief Register callback that is called when the worker process state
* changes.
*
* \code{.cpp}
* LWE::SharedWorker::RegisterOnStatusChangedHandler(
* [](LWE::WorkerProcessState state) {
* if (state == LWE::WorkerProcessState::Terminated) {
* printf("Terminated worker process\n");
* }
* }
* );
* \endcode
*
* \param cb state handling callback.
*
*/
static void RegisterOnStatusChangedHandler(
const std::function<void(WorkerProcessState)> &cb);

/**
* \brief Perform lightweight web engine shared worker cleanup.
* Called once when the lightweight web engine shared worker is no longer
* in use.
*
* \code{.cpp}
* LWE::SharedWorker::Finalize();
* \endcode
*
*/
static void Finalize();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,10 @@ enum class IdleModeJob {

IdleModeFull =
ClearDrawnBuffers | ForceGC | DropDecodedImageBuffer | ClearFontCache,
IdleModeMiddle = ForceGC,
IdleModeMiddle = ClearDrawnBuffers | ForceGC | DropDecodedImageBuffer,
IdleModeNone = 0,

IdleModeDefault = IdleModeFull
IdleModeDefault = IdleModeMiddle
};

constexpr int IdleModeCheckDefaultIntervalInMS{3000};
Expand Down
Binary file modified packages/webview_flutter_lwe/tizen/lib/aarch64/libclipper.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/aarch64/libmp4parse.so
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/aarch64/libskia_matrix.so
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/aarch64/libtuv.so
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/aarch64/libwebm.so
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/armel/libclipper.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/armel/libmp4parse.so
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/armel/libskia_matrix.so
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/armel/libtuv.so
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/armel/libwebm.so
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/i586/libclipper.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/i586/libmp4parse.so
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/i586/libskia_matrix.so
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/i586/libtuv.so
Binary file not shown.
Binary file modified packages/webview_flutter_lwe/tizen/lib/i586/libwebm.so
Binary file not shown.
9 changes: 2 additions & 7 deletions packages/webview_flutter_lwe/tizen/src/webview_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,8 @@ WebViewFactory::WebViewFactory(flutter::PluginRegistrar* registrar)
: PlatformViewFactory(registrar) {
texture_registrar_ = registrar->texture_registrar();

std::string data_path = GetAppDataPath();
std::string local_storage_path = data_path + "StarFish_localStorage.db";
std::string cookie_path = data_path + "StarFish_cookies.db";
std::string cache_path = data_path + "Starfish_cache.db";

LWE::LWE::Initialize(local_storage_path.c_str(), cookie_path.c_str(),
cache_path.c_str());
std::string data_path = GetAppDataPath() + std::string("Starfish_storage");
LWE::LWE::Initialize(data_path.c_str());
}

PlatformView* WebViewFactory::Create(int view_id, double width, double height,
Expand Down

0 comments on commit 6bbc3e7

Please sign in to comment.