Skip to content

Commit caf678d

Browse files
authored
Move common graphics utils to //flutter/common/graphics (#22320)
1 parent 76e6158 commit caf678d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+98
-60
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ FILE: ../../../flutter/benchmarking/benchmarking.cc
2121
FILE: ../../../flutter/benchmarking/benchmarking.h
2222
FILE: ../../../flutter/common/constants.h
2323
FILE: ../../../flutter/common/exported_symbols.sym
24+
FILE: ../../../flutter/common/graphics/gl_context_switch.cc
25+
FILE: ../../../flutter/common/graphics/gl_context_switch.h
26+
FILE: ../../../flutter/common/graphics/persistent_cache.cc
27+
FILE: ../../../flutter/common/graphics/persistent_cache.h
28+
FILE: ../../../flutter/common/graphics/texture.cc
29+
FILE: ../../../flutter/common/graphics/texture.h
2430
FILE: ../../../flutter/common/settings.cc
2531
FILE: ../../../flutter/common/settings.h
2632
FILE: ../../../flutter/common/task_runners.cc
@@ -33,8 +39,6 @@ FILE: ../../../flutter/flow/embedded_views.h
3339
FILE: ../../../flutter/flow/flow_run_all_unittests.cc
3440
FILE: ../../../flutter/flow/flow_test_utils.cc
3541
FILE: ../../../flutter/flow/flow_test_utils.h
36-
FILE: ../../../flutter/flow/gl_context_switch.cc
37-
FILE: ../../../flutter/flow/gl_context_switch.h
3842
FILE: ../../../flutter/flow/gl_context_switch_unittests.cc
3943
FILE: ../../../flutter/flow/instrumentation.cc
4044
FILE: ../../../flutter/flow/instrumentation.h
@@ -115,8 +119,6 @@ FILE: ../../../flutter/flow/surface.cc
115119
FILE: ../../../flutter/flow/surface.h
116120
FILE: ../../../flutter/flow/surface_frame.cc
117121
FILE: ../../../flutter/flow/surface_frame.h
118-
FILE: ../../../flutter/flow/texture.cc
119-
FILE: ../../../flutter/flow/texture.h
120122
FILE: ../../../flutter/flow/texture_unittests.cc
121123
FILE: ../../../flutter/flow/view_holder.cc
122124
FILE: ../../../flutter/flow/view_holder.h
@@ -620,8 +622,6 @@ FILE: ../../../flutter/shell/common/engine_unittests.cc
620622
FILE: ../../../flutter/shell/common/fixtures/shell_test.dart
621623
FILE: ../../../flutter/shell/common/fixtures/shelltest_screenshot.png
622624
FILE: ../../../flutter/shell/common/input_events_unittests.cc
623-
FILE: ../../../flutter/shell/common/persistent_cache.cc
624-
FILE: ../../../flutter/shell/common/persistent_cache.h
625625
FILE: ../../../flutter/shell/common/persistent_cache_unittests.cc
626626
FILE: ../../../flutter/shell/common/pipeline.cc
627627
FILE: ../../../flutter/shell/common/pipeline.h

common/graphics/BUILD.gn

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
5+
import("//flutter/common/config.gni")
6+
import("//flutter/testing/testing.gni")
7+
8+
source_set("graphics") {
9+
sources = [
10+
"gl_context_switch.cc",
11+
"gl_context_switch.h",
12+
"persistent_cache.cc",
13+
"persistent_cache.h",
14+
"texture.cc",
15+
"texture.h",
16+
]
17+
18+
# Heed caution when adding targets to the dependencies. This is a minimal
19+
# target containing graphics sources that embedders can depend on. Any
20+
# additions here could result in added app sizes across embeddings.
21+
deps = [
22+
"//flutter/assets",
23+
"//flutter/fml",
24+
"//flutter/shell/version:version",
25+
"//third_party/rapidjson",
26+
"//third_party/skia",
27+
]
28+
29+
public_configs = [ "//flutter:config" ]
30+
}

flow/gl_context_switch.cc renamed to common/graphics/gl_context_switch.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#include "flutter/flow/gl_context_switch.h"
5+
#include "flutter/common/graphics/gl_context_switch.h"
66

77
namespace flutter {
88

flow/gl_context_switch.h renamed to common/graphics/gl_context_switch.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifndef FLUTTER_FLOW_GL_CONTEXT_SWITCH_H_
6-
#define FLUTTER_FLOW_GL_CONTEXT_SWITCH_H_
5+
#ifndef FLUTTER_COMMON_GRAPHICS_GL_CONTEXT_SWITCH_H_
6+
#define FLUTTER_COMMON_GRAPHICS_GL_CONTEXT_SWITCH_H_
77

88
#include <functional>
99
#include <memory>
@@ -111,4 +111,4 @@ class GLContextSwitch final : public GLContextResult {
111111

112112
} // namespace flutter
113113

114-
#endif // FLUTTER_FLOW_GL_CONTEXT_SWITCH_H_
114+
#endif // FLUTTER_COMMON_GRAPHICS_GL_CONTEXT_SWITCH_H_

shell/common/persistent_cache.cc renamed to common/graphics/persistent_cache.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#include "flutter/shell/common/persistent_cache.h"
5+
#include "flutter/common/graphics/persistent_cache.h"
66

77
#include <future>
88
#include <memory>

shell/common/persistent_cache.h renamed to common/graphics/persistent_cache.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifndef FLUTTER_SHELL_COMMON_PERSISTENT_CACHE_H_
6-
#define FLUTTER_SHELL_COMMON_PERSISTENT_CACHE_H_
5+
#ifndef FLUTTER_COMMON_GRAPHICS_PERSISTENT_CACHE_H_
6+
#define FLUTTER_COMMON_GRAPHICS_PERSISTENT_CACHE_H_
77

88
#include <memory>
99
#include <mutex>
@@ -134,4 +134,4 @@ class PersistentCache : public GrContextOptions::PersistentCache {
134134

135135
} // namespace flutter
136136

137-
#endif // FLUTTER_SHELL_COMMON_PERSISTENT_CACHE_H_
137+
#endif // FLUTTER_COMMON_GRAPHICS_PERSISTENT_CACHE_H_

flow/texture.cc renamed to common/graphics/texture.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#include "flutter/flow/texture.h"
5+
#include "flutter/common/graphics/texture.h"
66

77
namespace flutter {
88

flow/texture.h renamed to common/graphics/texture.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifndef FLUTTER_FLOW_TEXTURE_H_
6-
#define FLUTTER_FLOW_TEXTURE_H_
5+
#ifndef FLUTTER_COMMON_GRAPHICS_TEXTURE_H_
6+
#define FLUTTER_COMMON_GRAPHICS_TEXTURE_H_
77

88
#include <map>
99

@@ -74,4 +74,4 @@ class TextureRegistry {
7474

7575
} // namespace flutter
7676

77-
#endif // FLUTTER_FLOW_TEXTURE_H_
77+
#endif // FLUTTER_COMMON_GRAPHICS_TEXTURE_H_

flow/BUILD.gn

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ source_set("flow") {
1212
"compositor_context.h",
1313
"embedded_views.cc",
1414
"embedded_views.h",
15-
"gl_context_switch.cc",
16-
"gl_context_switch.h",
1715
"instrumentation.cc",
1816
"instrumentation.h",
1917
"layers/backdrop_filter_layer.cc",
@@ -66,14 +64,13 @@ source_set("flow") {
6664
"surface.h",
6765
"surface_frame.cc",
6866
"surface_frame.h",
69-
"texture.cc",
70-
"texture.h",
7167
]
7268

7369
public_configs = [ "//flutter:config" ]
7470

7571
deps = [
7672
"//flutter/common",
73+
"//flutter/common/graphics",
7774
"//flutter/fml",
7875
"//third_party/skia",
7976
]
@@ -124,7 +121,10 @@ if (enable_unittests) {
124121
"//third_party/googletest:gtest",
125122
]
126123

127-
deps = [ ":flow" ]
124+
deps = [
125+
":flow",
126+
"//flutter/common/graphics",
127+
]
128128
}
129129

130130
executable("flow_unittests") {
@@ -167,6 +167,7 @@ if (enable_unittests) {
167167
":flow",
168168
":flow_fixtures",
169169
":flow_testing",
170+
"//flutter/common/graphics",
170171
"//flutter/fml",
171172
"//flutter/testing:skia",
172173
"//flutter/testing:testing_lib",

flow/compositor_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
#include <memory>
99
#include <string>
1010

11+
#include "flutter/common/graphics/texture.h"
1112
#include "flutter/flow/embedded_views.h"
1213
#include "flutter/flow/instrumentation.h"
1314
#include "flutter/flow/raster_cache.h"
14-
#include "flutter/flow/texture.h"
1515
#include "flutter/fml/macros.h"
1616
#include "flutter/fml/raster_thread_merger.h"
1717
#include "third_party/skia/include/core/SkCanvas.h"

flow/gl_context_switch_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// found in the LICENSE file.
44
#define FML_USED_ON_EMBEDDER
55

6-
#include "flutter/flow/gl_context_switch.h"
6+
#include "flutter/common/graphics/gl_context_switch.h"
77

88
#include <functional>
99
#include <future>

flow/layers/layer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
#include <memory>
99
#include <vector>
1010

11+
#include "flutter/common/graphics/texture.h"
1112
#include "flutter/flow/embedded_views.h"
1213
#include "flutter/flow/instrumentation.h"
1314
#include "flutter/flow/raster_cache.h"
14-
#include "flutter/flow/texture.h"
1515
#include "flutter/fml/build_config.h"
1616
#include "flutter/fml/compiler_specific.h"
1717
#include "flutter/fml/logging.h"

flow/layers/texture_layer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include "flutter/flow/layers/texture_layer.h"
66

7-
#include "flutter/flow/texture.h"
7+
#include "flutter/common/graphics/texture.h"
88

99
namespace flutter {
1010

flow/surface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
#include <memory>
99

10+
#include "flutter/common/graphics/gl_context_switch.h"
1011
#include "flutter/flow/embedded_views.h"
11-
#include "flutter/flow/gl_context_switch.h"
1212
#include "flutter/flow/surface_frame.h"
1313
#include "flutter/fml/macros.h"
1414

flow/surface_frame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include <memory>
99

10-
#include "flutter/flow/gl_context_switch.h"
10+
#include "flutter/common/graphics/gl_context_switch.h"
1111
#include "flutter/fml/macros.h"
1212
#include "third_party/skia/include/core/SkCanvas.h"
1313
#include "third_party/skia/include/core/SkSurface.h"

flow/testing/gl_context_switch_test.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#ifndef FLUTTER_SHELL_RENDERER_CONTEXT_TEST_H_
66
#define FLUTTER_SHELL_RENDERER_CONTEXT_TEST_H_
77

8-
#include "flutter/flow/gl_context_switch.h"
8+
#include "flutter/common/graphics/gl_context_switch.h"
99
#include "gtest/gtest.h"
1010

1111
namespace flutter {

flow/testing/mock_texture.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <ostream>
66
#include <vector>
77

8-
#include "flutter/flow/texture.h"
8+
#include "flutter/common/graphics/texture.h"
99
#include "flutter/testing/assertions_skia.h"
1010

1111
namespace flutter {

flow/texture_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#include "flutter/flow/texture.h"
5+
#include "flutter/common/graphics/texture.h"
66

77
#include "flutter/flow/testing/mock_texture.h"
88
#include "gtest/gtest.h"

shell/common/BUILD.gn

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ source_set("common") {
6969
"display_manager.h",
7070
"engine.cc",
7171
"engine.h",
72-
"persistent_cache.cc",
73-
"persistent_cache.h",
7472
"pipeline.cc",
7573
"pipeline.h",
7674
"platform_view.cc",
@@ -111,6 +109,7 @@ source_set("common") {
111109
deps = [
112110
"//flutter/assets",
113111
"//flutter/common",
112+
"//flutter/common/graphics",
114113
"//flutter/flow",
115114
"//flutter/fml",
116115
"//flutter/lib/ui",
@@ -189,6 +188,7 @@ if (enable_unittests) {
189188
]
190189

191190
public_deps = [
191+
"//flutter/common/graphics",
192192
"//flutter/flow",
193193
"//flutter/fml/dart",
194194
"//flutter/runtime",
@@ -253,6 +253,7 @@ if (enable_unittests) {
253253
":shell_test_fixture_sources",
254254
":shell_unittests_fixtures",
255255
"//flutter/assets",
256+
"//flutter/common/graphics",
256257
"//flutter/shell/version",
257258
"//third_party/googletest:gmock",
258259
]

shell/common/persistent_cache_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#include "flutter/shell/common/persistent_cache.h"
5+
#include "flutter/common/graphics/persistent_cache.h"
66

77
#include <memory>
88

shell/common/platform_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#include <memory>
99

1010
#include "flow/embedded_views.h"
11+
#include "flutter/common/graphics/texture.h"
1112
#include "flutter/common/task_runners.h"
1213
#include "flutter/flow/surface.h"
13-
#include "flutter/flow/texture.h"
1414
#include "flutter/fml/macros.h"
1515
#include "flutter/fml/memory/weak_ptr.h"
1616
#include "flutter/lib/ui/semantics/custom_accessibility_action.h"

shell/common/rasterizer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
#include <utility>
88

9+
#include "flutter/common/graphics/persistent_cache.h"
910
#include "flutter/fml/time/time_delta.h"
1011
#include "flutter/fml/time/time_point.h"
11-
#include "flutter/shell/common/persistent_cache.h"
1212
#include "flutter/shell/common/serialization_callbacks.h"
1313
#include "third_party/skia/include/core/SkEncodedImageFormat.h"
1414
#include "third_party/skia/include/core/SkImageEncoder.h"

shell/common/run_configuration.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#include <sstream>
88

99
#include "flutter/assets/directory_asset_bundle.h"
10+
#include "flutter/common/graphics/persistent_cache.h"
1011
#include "flutter/fml/file.h"
1112
#include "flutter/fml/unique_fd.h"
1213
#include "flutter/runtime/dart_vm.h"
13-
#include "flutter/shell/common/persistent_cache.h"
1414

1515
namespace flutter {
1616

shell/common/shell.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <vector>
1111

1212
#include "flutter/assets/directory_asset_bundle.h"
13+
#include "flutter/common/graphics/persistent_cache.h"
1314
#include "flutter/fml/file.h"
1415
#include "flutter/fml/icu_util.h"
1516
#include "flutter/fml/log_settings.h"
@@ -21,7 +22,6 @@
2122
#include "flutter/fml/unique_fd.h"
2223
#include "flutter/runtime/dart_vm.h"
2324
#include "flutter/shell/common/engine.h"
24-
#include "flutter/shell/common/persistent_cache.h"
2525
#include "flutter/shell/common/skia_event_tracer_impl.h"
2626
#include "flutter/shell/common/switches.h"
2727
#include "flutter/shell/common/vsync_waiter.h"

shell/common/shell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
#include <unordered_map>
1212

1313
#include "flutter/assets/directory_asset_bundle.h"
14+
#include "flutter/common/graphics/texture.h"
1415
#include "flutter/common/settings.h"
1516
#include "flutter/common/task_runners.h"
1617
#include "flutter/flow/surface.h"
17-
#include "flutter/flow/texture.h"
1818
#include "flutter/fml/closure.h"
1919
#include "flutter/fml/macros.h"
2020
#include "flutter/fml/memory/ref_ptr.h"

shell/common/shell_io_manager.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
#include "flutter/shell/common/shell_io_manager.h"
66

7+
#include "flutter/common/graphics/persistent_cache.h"
78
#include "flutter/fml/build_config.h"
89
#include "flutter/fml/message_loop.h"
9-
#include "flutter/shell/common/persistent_cache.h"
1010
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
1111

1212
namespace flutter {

0 commit comments

Comments
 (0)