Skip to content

Commit 4d1b9b5

Browse files
committed
Revert "started providing the GPU sync switch to external view embedders (flutter#22302)"
This reverts commit 1c3bc02.
1 parent 290836f commit 4d1b9b5

19 files changed

+44
-85
lines changed

flow/embedded_views.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66

77
namespace flutter {
88

9-
void ExternalViewEmbedder::SubmitFrame(
10-
GrDirectContext* context,
11-
std::unique_ptr<SurfaceFrame> frame,
12-
const std::shared_ptr<const fml::SyncSwitch>& gpu_disable_sync_switch) {
9+
void ExternalViewEmbedder::SubmitFrame(GrDirectContext* context,
10+
std::unique_ptr<SurfaceFrame> frame) {
1311
frame->Submit();
1412
};
1513

flow/embedded_views.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "flutter/flow/surface_frame.h"
1111
#include "flutter/fml/memory/ref_counted.h"
1212
#include "flutter/fml/raster_thread_merger.h"
13-
#include "flutter/fml/synchronization/sync_switch.h"
1413
#include "third_party/skia/include/core/SkCanvas.h"
1514
#include "third_party/skia/include/core/SkPath.h"
1615
#include "third_party/skia/include/core/SkPoint.h"
@@ -313,10 +312,8 @@ class ExternalViewEmbedder {
313312
// This method can mutate the root Skia canvas before submitting the frame.
314313
//
315314
// It can also allocate frames for overlay surfaces to compose hybrid views.
316-
virtual void SubmitFrame(
317-
GrDirectContext* context,
318-
std::unique_ptr<SurfaceFrame> frame,
319-
const std::shared_ptr<const fml::SyncSwitch>& gpu_disable_sync_switch);
315+
virtual void SubmitFrame(GrDirectContext* context,
316+
std::unique_ptr<SurfaceFrame> frame);
320317

321318
// This method provides the embedder a way to do additional tasks after
322319
// |SubmitFrame|. For example, merge task runners if `should_resubmit_frame`

shell/common/rasterizer.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,8 @@ RasterStatus Rasterizer::DrawToSurfaceUnsafe(
536536
if (external_view_embedder_ &&
537537
(!raster_thread_merger_ || raster_thread_merger_->IsMerged())) {
538538
FML_DCHECK(!frame->IsSubmitted());
539-
external_view_embedder_->SubmitFrame(
540-
surface_->GetContext(), std::move(frame),
541-
delegate_.GetIsGpuDisabledSyncSwitch());
539+
external_view_embedder_->SubmitFrame(surface_->GetContext(),
540+
std::move(frame));
542541
} else {
543542
frame->Submit();
544543
}

shell/common/rasterizer_unittests.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ class MockExternalViewEmbedder : public ExternalViewEmbedder {
6363
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger));
6464
MOCK_METHOD0(GetCurrentCanvases, std::vector<SkCanvas*>());
6565
MOCK_METHOD1(CompositeEmbeddedView, SkCanvas*(int view_id));
66-
MOCK_METHOD3(SubmitFrame,
66+
MOCK_METHOD2(SubmitFrame,
6767
void(GrDirectContext* context,
68-
std::unique_ptr<SurfaceFrame> frame,
69-
const std::shared_ptr<const fml::SyncSwitch>&
70-
gpu_disable_sync_switch));
68+
std::unique_ptr<SurfaceFrame> frame));
7169
MOCK_METHOD2(EndFrame,
7270
void(bool should_resubmit_frame,
7371
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger));

shell/common/shell_test_external_view_embedder.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ SkCanvas* ShellTestExternalViewEmbedder::CompositeEmbeddedView(int view_id) {
6363
// |ExternalViewEmbedder|
6464
void ShellTestExternalViewEmbedder::SubmitFrame(
6565
GrDirectContext* context,
66-
std::unique_ptr<SurfaceFrame> frame,
67-
const std::shared_ptr<const fml::SyncSwitch>& gpu_disable_sync_switch) {
66+
std::unique_ptr<SurfaceFrame> frame) {
6867
frame->Submit();
6968
if (frame && frame->SkiaSurface()) {
7069
last_submitted_frame_size_ = SkISize::Make(frame->SkiaSurface()->width(),

shell/common/shell_test_external_view_embedder.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ class ShellTestExternalViewEmbedder final : public ExternalViewEmbedder {
6363

6464
// |ExternalViewEmbedder|
6565
void SubmitFrame(GrDirectContext* context,
66-
std::unique_ptr<SurfaceFrame> frame,
67-
const std::shared_ptr<const fml::SyncSwitch>&
68-
gpu_disable_sync_switch) override;
66+
std::unique_ptr<SurfaceFrame> frame) override;
6967

7068
// |ExternalViewEmbedder|
7169
void EndFrame(

shell/platform/android/external_view_embedder/external_view_embedder.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ SkRect AndroidExternalViewEmbedder::GetViewRect(int view_id) const {
7575
// |ExternalViewEmbedder|
7676
void AndroidExternalViewEmbedder::SubmitFrame(
7777
GrDirectContext* context,
78-
std::unique_ptr<SurfaceFrame> frame,
79-
const std::shared_ptr<const fml::SyncSwitch>& gpu_disable_sync_switch) {
78+
std::unique_ptr<SurfaceFrame> frame) {
8079
TRACE_EVENT0("flutter", "AndroidExternalViewEmbedder::SubmitFrame");
8180

8281
if (!FrameHasPlatformLayers()) {

shell/platform/android/external_view_embedder/external_view_embedder.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ class AndroidExternalViewEmbedder final : public ExternalViewEmbedder {
4747

4848
// |ExternalViewEmbedder|
4949
void SubmitFrame(GrDirectContext* context,
50-
std::unique_ptr<SurfaceFrame> frame,
51-
const std::shared_ptr<const fml::SyncSwitch>&
52-
gpu_disable_sync_switch) override;
50+
std::unique_ptr<SurfaceFrame> frame) override;
5351

5452
// |ExternalViewEmbedder|
5553
PostPrerollResult PostPrerollAction(

shell/platform/android/external_view_embedder/external_view_embedder_unittests.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrame) {
334334
return true;
335335
});
336336

337-
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame), nullptr);
337+
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame));
338338
// Submits frame if no Android view in the current frame.
339339
EXPECT_TRUE(did_submit_frame);
340340
// Doesn't resubmit frame.
@@ -401,7 +401,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrame) {
401401
return true;
402402
});
403403

404-
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame), nullptr);
404+
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame));
405405
// Doesn't submit frame if there aren't Android views in the previous frame.
406406
EXPECT_FALSE(did_submit_frame);
407407
// Resubmits frame.
@@ -465,7 +465,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrame) {
465465
}
466466
return true;
467467
});
468-
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame), nullptr);
468+
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame));
469469
// Submits frame if there are Android views in the previous frame.
470470
EXPECT_TRUE(did_submit_frame);
471471
// Doesn't resubmit frame.
@@ -573,7 +573,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrame__overlayComposition) {
573573
return true;
574574
});
575575

576-
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame), nullptr);
576+
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame));
577577

578578
EXPECT_CALL(*jni_mock, FlutterViewEndFrame());
579579
embedder->EndFrame(/*should_resubmit_frame=*/false, raster_thread_merger);
@@ -640,7 +640,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrame__platformViewWithoutAnyOverlay) {
640640
return true;
641641
});
642642

643-
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame), nullptr);
643+
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame));
644644

645645
EXPECT_CALL(*jni_mock, FlutterViewEndFrame());
646646
embedder->EndFrame(/*should_resubmit_frame=*/false, raster_thread_merger);
@@ -734,7 +734,7 @@ TEST(AndroidExternalViewEmbedder, DestroyOverlayLayersOnSizeChange) {
734734
std::make_unique<SurfaceFrame>(SkSurface::MakeNull(1000, 1000), false,
735735
[](const SurfaceFrame& surface_frame,
736736
SkCanvas* canvas) { return true; });
737-
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame), nullptr);
737+
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame));
738738

739739
EXPECT_CALL(*jni_mock, FlutterViewEndFrame());
740740
embedder->EndFrame(/*should_resubmit_frame=*/false, raster_thread_merger);
@@ -816,7 +816,7 @@ TEST(AndroidExternalViewEmbedder, DoesNotDestroyOverlayLayersOnSizeChange) {
816816
std::make_unique<SurfaceFrame>(SkSurface::MakeNull(1000, 1000), false,
817817
[](const SurfaceFrame& surface_frame,
818818
SkCanvas* canvas) { return true; });
819-
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame), nullptr);
819+
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame));
820820

821821
EXPECT_CALL(*jni_mock, FlutterViewEndFrame());
822822
embedder->EndFrame(/*should_resubmit_frame=*/false, raster_thread_merger);

shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -462,22 +462,9 @@
462462
);
463463
}
464464

465-
bool FlutterPlatformViewsController::SubmitFrame(
466-
GrDirectContext* gr_context,
467-
std::shared_ptr<IOSContext> ios_context,
468-
std::unique_ptr<SurfaceFrame> frame,
469-
const std::shared_ptr<const fml::SyncSwitch>& gpu_disable_sync_switch) {
470-
bool result = false;
471-
gpu_disable_sync_switch->Execute(
472-
fml::SyncSwitch::Handlers().SetIfTrue([&] { result = false; }).SetIfFalse([&] {
473-
result = SubmitFrameGpuSafe(gr_context, ios_context, std::move(frame));
474-
}));
475-
return result;
476-
}
477-
478-
bool FlutterPlatformViewsController::SubmitFrameGpuSafe(GrDirectContext* gr_context,
479-
std::shared_ptr<IOSContext> ios_context,
480-
std::unique_ptr<SurfaceFrame> frame) {
465+
bool FlutterPlatformViewsController::SubmitFrame(GrDirectContext* gr_context,
466+
std::shared_ptr<IOSContext> ios_context,
467+
std::unique_ptr<SurfaceFrame> frame) {
481468
// Any UIKit related code has to run on main thread.
482469
FML_DCHECK([[NSThread currentThread] isMainThread]);
483470
if (flutter_view_ == nullptr) {

0 commit comments

Comments
 (0)