Skip to content

Commit a83c240

Browse files
committed
[webview_flutter_lwe] Fix clang-format violations in webview.cc
The navigation-delegate and JavaScript-channel callback lambdas added in the preceding commits were not clang-format clean, failing the repository's format CI check. Reflow them to match clang-format (Google style).
1 parent 65dbd9a commit a83c240

1 file changed

Lines changed: 26 additions & 31 deletions

File tree

packages/webview_flutter_lwe/tizen/src/webview.cc

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,17 @@ WebView::WebView(flutter::PluginRegistrar* registrar, int view_id,
164164
flutter::EncodableMap args = {
165165
{flutter::EncodableValue("url"), flutter::EncodableValue(url)}};
166166

167-
dispatcher_->dispatchTaskOnMainThread(
168-
[this, args, alive = is_alive_]() {
169-
if (!*alive) return;
170-
navigation_delegate_channel_->InvokeMethod(
171-
"onPageStarted",
172-
std::make_unique<flutter::EncodableValue>(args));
173-
// The lightweight web engine has no dedicated URL-change
174-
// callback, so report a URL change whenever a navigation
175-
// starts.
176-
navigation_delegate_channel_->InvokeMethod(
177-
"onUrlChange",
178-
std::make_unique<flutter::EncodableValue>(args));
179-
});
167+
dispatcher_->dispatchTaskOnMainThread([this, args,
168+
alive = is_alive_]() {
169+
if (!*alive) return;
170+
navigation_delegate_channel_->InvokeMethod(
171+
"onPageStarted", std::make_unique<flutter::EncodableValue>(args));
172+
// The lightweight web engine has no dedicated URL-change
173+
// callback, so report a URL change whenever a navigation
174+
// starts.
175+
navigation_delegate_channel_->InvokeMethod(
176+
"onUrlChange", std::make_unique<flutter::EncodableValue>(args));
177+
});
180178
});
181179
webview_instance_->RegisterOnPageLoadedHandler(
182180
[this](LWE::WebContainer* container, const std::string& url) {
@@ -196,13 +194,12 @@ WebView::WebView(flutter::PluginRegistrar* registrar, int view_id,
196194
flutter::EncodableMap args = {{flutter::EncodableValue("progress"),
197195
flutter::EncodableValue(progress)}};
198196

199-
dispatcher_->dispatchTaskOnMainThread(
200-
[this, args, alive = is_alive_]() {
201-
if (!*alive) return;
202-
navigation_delegate_channel_->InvokeMethod(
203-
"onProgress",
204-
std::make_unique<flutter::EncodableValue>(args));
205-
});
197+
dispatcher_->dispatchTaskOnMainThread([this, args,
198+
alive = is_alive_]() {
199+
if (!*alive) return;
200+
navigation_delegate_channel_->InvokeMethod(
201+
"onProgress", std::make_unique<flutter::EncodableValue>(args));
202+
});
206203
});
207204
webview_instance_->RegisterOnReceivedErrorHandler(
208205
[this](LWE::WebContainer* container, LWE::ResourceError error) {
@@ -236,8 +233,8 @@ WebView::WebView(flutter::PluginRegistrar* registrar, int view_id,
236233
dispatcher_->dispatchTaskOnMainThread(
237234
[this, args, url, alive = is_alive_]() {
238235
if (!*alive) return;
239-
auto result = std::make_unique<NavigationRequestResult>(
240-
url, this, alive);
236+
auto result =
237+
std::make_unique<NavigationRequestResult>(url, this, alive);
241238
navigation_delegate_channel_->InvokeMethod(
242239
"navigationRequest",
243240
std::make_unique<flutter::EncodableValue>(args),
@@ -261,13 +258,12 @@ void WebView::RegisterJavaScriptChannelName(const std::string& name) {
261258
{flutter::EncodableValue("message"), flutter::EncodableValue(message)},
262259
};
263260

264-
dispatcher_->dispatchTaskOnMainThread(
265-
[this, args, alive = is_alive_]() {
266-
if (!*alive) return;
267-
webview_channel_->InvokeMethod(
268-
"javaScriptChannelMessage",
269-
std::make_unique<flutter::EncodableValue>(args));
270-
});
261+
dispatcher_->dispatchTaskOnMainThread([this, args, alive = is_alive_]() {
262+
if (!*alive) return;
263+
webview_channel_->InvokeMethod(
264+
"javaScriptChannelMessage",
265+
std::make_unique<flutter::EncodableValue>(args));
266+
});
271267
return "success";
272268
};
273269
webview_instance_->AddJavaScriptInterface(name, "postMessage", on_message);
@@ -325,8 +321,7 @@ void WebView::Dispose() {
325321
// after the WebView has been destroyed, the (stateless) dispatcher is kept
326322
// alive by the callback's own shared_ptr copy instead of dangling.
327323
texture_registrar_->UnregisterTexture(
328-
GetTextureId(),
329-
[pool, dispatcher = dispatcher_]() {
324+
GetTextureId(), [pool, dispatcher = dispatcher_]() {
330325
// Invoked on the render thread once the texture is fully unregistered.
331326
// Hand the pool to a main-thread task for destruction; by this point
332327
// the raster thread has released all GPU resources and the LWE engine

0 commit comments

Comments
 (0)