Flutter Engine
shell_test_external_view_embedder.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
6 
7 namespace flutter {
8 
10  const EndFrameCallBack& end_frame_call_back,
11  PostPrerollResult post_preroll_result,
12  bool support_thread_merging)
13  : end_frame_call_back_(end_frame_call_back),
14  post_preroll_result_(post_preroll_result),
15  support_thread_merging_(support_thread_merging),
16  submitted_frame_count_(0) {}
17 
19  PostPrerollResult post_preroll_result) {
20  post_preroll_result_ = post_preroll_result;
21 }
22 
24  return submitted_frame_count_;
25 }
26 
28  return last_submitted_frame_size_;
29 }
30 
31 // |ExternalViewEmbedder|
32 void ShellTestExternalViewEmbedder::CancelFrame() {}
33 
34 // |ExternalViewEmbedder|
35 void ShellTestExternalViewEmbedder::BeginFrame(
36  SkISize frame_size,
37  GrDirectContext* context,
38  double device_pixel_ratio,
39  fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) {}
40 
41 // |ExternalViewEmbedder|
42 void ShellTestExternalViewEmbedder::PrerollCompositeEmbeddedView(
43  int view_id,
44  std::unique_ptr<EmbeddedViewParams> params) {}
45 
46 // |ExternalViewEmbedder|
47 PostPrerollResult ShellTestExternalViewEmbedder::PostPrerollAction(
48  fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) {
49  FML_DCHECK(raster_thread_merger);
50  return post_preroll_result_;
51 }
52 
53 // |ExternalViewEmbedder|
54 std::vector<SkCanvas*> ShellTestExternalViewEmbedder::GetCurrentCanvases() {
55  return {};
56 }
57 
58 // |ExternalViewEmbedder|
59 SkCanvas* ShellTestExternalViewEmbedder::CompositeEmbeddedView(int view_id) {
60  return nullptr;
61 }
62 
63 // |ExternalViewEmbedder|
64 void ShellTestExternalViewEmbedder::SubmitFrame(
65  GrDirectContext* context,
66  std::unique_ptr<SurfaceFrame> frame) {
67  frame->Submit();
68  if (frame && frame->SkiaSurface()) {
69  last_submitted_frame_size_ = SkISize::Make(frame->SkiaSurface()->width(),
70  frame->SkiaSurface()->height());
71  } else {
72  last_submitted_frame_size_ = SkISize::MakeEmpty();
73  }
74  submitted_frame_count_++;
75 }
76 
77 // |ExternalViewEmbedder|
78 void ShellTestExternalViewEmbedder::EndFrame(
79  bool should_resubmit_frame,
80  fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) {
81  end_frame_call_back_(should_resubmit_frame, raster_thread_merger);
82 }
83 
84 // |ExternalViewEmbedder|
85 SkCanvas* ShellTestExternalViewEmbedder::GetRootCanvas() {
86  return nullptr;
87 }
88 
89 bool ShellTestExternalViewEmbedder::SupportsDynamicThreadMerging() {
90  return support_thread_merging_;
91 }
92 
93 } // namespace flutter
ShellTestExternalViewEmbedder(const EndFrameCallBack &end_frame_call_back, PostPrerollResult post_preroll_result, bool support_thread_merging)
#define FML_DCHECK(condition)
Definition: logging.h:86
std::function< void(bool, fml::RefPtr< fml::RasterThreadMerger >)> EndFrameCallBack
void UpdatePostPrerollResult(PostPrerollResult post_preroll_result)