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"

0 commit comments

Comments
 (0)