Skip to content

Commit

Permalink
[webview_flutter] Remove unused code (flutter-tizen#377)
Browse files Browse the repository at this point in the history
* Remove unused code.
* Fix build warnings.

Signed-off-by: Boram Bae <[email protected]>
  • Loading branch information
bbrto21 authored May 10, 2022
1 parent 61aeb97 commit dd5d56a
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 23 deletions.
5 changes: 5 additions & 0 deletions packages/webview_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.4.3

* Remove unused things.
* Fix build warnings.

## 0.4.2

* Support background color.
Expand Down
2 changes: 1 addition & 1 deletion packages/webview_flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
sdk: flutter
path_provider: ^2.0.7
path_provider_tizen: ^2.0.2
webview_flutter: ^3.0.1
webview_flutter: ^3.0.2
webview_flutter_tizen:
path: ../

Expand Down
2 changes: 1 addition & 1 deletion packages/webview_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: webview_flutter_tizen
description: Tizen implementation of the webview plugin
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/webview_flutter
version: 0.4.2
version: 0.4.3

environment:
sdk: ">=2.14.0 <3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/webview_flutter/tizen/src/buffer_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class BufferUnit {
class BufferPool {
public:
explicit BufferPool(int width, int height, int pool_size);
~BufferPool();
virtual ~BufferPool();

virtual BufferUnit* GetAvailableBuffer();
virtual void Release(BufferUnit* unit);
Expand Down
12 changes: 5 additions & 7 deletions packages/webview_flutter/tizen/src/webview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "webview_factory.h"

#define BUFFER_POOL_SIZE 5
#define LWE_EXPORT

extern "C" size_t LWE_EXPORT createWebViewInstance(
unsigned x, unsigned y, unsigned width, unsigned height,
float devicePixelRatio, const char* defaultFontName, const char* locale,
Expand Down Expand Up @@ -156,22 +156,20 @@ bool NeedsSwBackend(void) {

WebView::WebView(flutter::PluginRegistrar* registrar, int viewId,
flutter::TextureRegistrar* texture_registrar, double width,
double height, flutter::EncodableMap& params,
void* platform_window)
: PlatformView(registrar, viewId, platform_window),
double height, flutter::EncodableMap& params)
: PlatformView(registrar, viewId, nullptr),
texture_registrar_(texture_registrar),
webview_instance_(nullptr),
width_(width),
height_(height),
working_surface_(nullptr),
candidate_surface_(nullptr),
is_mouse_lbutton_down_(false),
rendered_surface_(nullptr),
is_mouse_lbutton_down_(false),
has_navigation_delegate_(false),
has_progress_tracking_(false),
context_(nullptr),
texture_variant_(nullptr),
platform_window_(platform_window) {
texture_variant_(nullptr) {
use_sw_backend_ = NeedsSwBackend();
if (use_sw_backend_) {
tbm_pool_ = std::make_unique<SingleBufferPool>(width, height);
Expand Down
3 changes: 1 addition & 2 deletions packages/webview_flutter/tizen/src/webview.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class WebView : public PlatformView {
public:
WebView(flutter::PluginRegistrar* registrar, int viewId,
flutter::TextureRegistrar* textureRegistrar, double width,
double height, flutter::EncodableMap& params, void* platform_window);
double height, flutter::EncodableMap& params);
~WebView();
virtual void Dispose() override;
virtual void Resize(double width, double height) override;
Expand Down Expand Up @@ -83,7 +83,6 @@ class WebView : public PlatformView {
flutter::TextureVariant* texture_variant_;
std::mutex mutex_;
std::unique_ptr<BufferPool> tbm_pool_;
void* platform_window_;
bool use_sw_backend_;
};

Expand Down
9 changes: 3 additions & 6 deletions packages/webview_flutter/tizen/src/webview_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
#include "lwe/LWEWebView.h"

WebViewFactory::WebViewFactory(flutter::PluginRegistrar* registrar,
flutter::TextureRegistrar* texture_registrar,
void* platform_window)
: PlatformViewFactory(registrar),
texture_registrar_(texture_registrar),
platform_window_(platform_window) {
flutter::TextureRegistrar* texture_registrar)
: PlatformViewFactory(registrar), texture_registrar_(texture_registrar) {
char* path = app_get_data_path();
std::string path_string;
if (!path || strlen(path) == 0) {
Expand Down Expand Up @@ -49,7 +46,7 @@ PlatformView* WebViewFactory::Create(

try {
return new WebView(GetPluginRegistrar(), view_id, texture_registrar_, width,
height, params, platform_window_);
height, params);
} catch (const std::invalid_argument& ex) {
LOG_ERROR("[Exception] %s\n", ex.what());
return nullptr;
Expand Down
4 changes: 1 addition & 3 deletions packages/webview_flutter/tizen/src/webview_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@
class WebViewFactory : public PlatformViewFactory {
public:
WebViewFactory(flutter::PluginRegistrar* registrar,
flutter::TextureRegistrar* textureRegistrar,
void* platform_window);
flutter::TextureRegistrar* textureRegistrar);
virtual void Dispose() override;
virtual PlatformView* Create(
int viewId, double width, double height,
const std::vector<uint8_t>& createParams) override;

private:
flutter::TextureRegistrar* texture_registrar_;
void* platform_window_;
};

#endif // FLUTTER_PLUGIN_WEBVIEW_FLUTTER_TIZEN_WEVIEW_FACTORY_H_
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ void WebviewFlutterTizenPluginRegisterWithRegistrar(
flutter::PluginRegistrarManager::GetInstance()
->GetRegistrar<flutter::PluginRegistrar>(registrar);
auto factory = std::make_unique<WebViewFactory>(
core_registrar, core_registrar->texture_registrar(),
FlutterDesktopPluginRegistrarGetNativeWindow(registrar));
core_registrar, core_registrar->texture_registrar());
FlutterDesktopRegisterViewFactory(registrar, kViewType, std::move(factory));
WebviewFlutterTizenPlugin::RegisterWithRegistrar(core_registrar);
}

0 comments on commit dd5d56a

Please sign in to comment.