Skip to content

Commit

Permalink
Move common graphics utils to //flutter/common/graphics (flutter#22320)
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik authored Nov 10, 2020
1 parent 76e6158 commit caf678d
Show file tree
Hide file tree
Showing 49 changed files with 98 additions and 60 deletions.
12 changes: 6 additions & 6 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ FILE: ../../../flutter/benchmarking/benchmarking.cc
FILE: ../../../flutter/benchmarking/benchmarking.h
FILE: ../../../flutter/common/constants.h
FILE: ../../../flutter/common/exported_symbols.sym
FILE: ../../../flutter/common/graphics/gl_context_switch.cc
FILE: ../../../flutter/common/graphics/gl_context_switch.h
FILE: ../../../flutter/common/graphics/persistent_cache.cc
FILE: ../../../flutter/common/graphics/persistent_cache.h
FILE: ../../../flutter/common/graphics/texture.cc
FILE: ../../../flutter/common/graphics/texture.h
FILE: ../../../flutter/common/settings.cc
FILE: ../../../flutter/common/settings.h
FILE: ../../../flutter/common/task_runners.cc
Expand All @@ -33,8 +39,6 @@ FILE: ../../../flutter/flow/embedded_views.h
FILE: ../../../flutter/flow/flow_run_all_unittests.cc
FILE: ../../../flutter/flow/flow_test_utils.cc
FILE: ../../../flutter/flow/flow_test_utils.h
FILE: ../../../flutter/flow/gl_context_switch.cc
FILE: ../../../flutter/flow/gl_context_switch.h
FILE: ../../../flutter/flow/gl_context_switch_unittests.cc
FILE: ../../../flutter/flow/instrumentation.cc
FILE: ../../../flutter/flow/instrumentation.h
Expand Down Expand Up @@ -115,8 +119,6 @@ FILE: ../../../flutter/flow/surface.cc
FILE: ../../../flutter/flow/surface.h
FILE: ../../../flutter/flow/surface_frame.cc
FILE: ../../../flutter/flow/surface_frame.h
FILE: ../../../flutter/flow/texture.cc
FILE: ../../../flutter/flow/texture.h
FILE: ../../../flutter/flow/texture_unittests.cc
FILE: ../../../flutter/flow/view_holder.cc
FILE: ../../../flutter/flow/view_holder.h
Expand Down Expand Up @@ -620,8 +622,6 @@ FILE: ../../../flutter/shell/common/engine_unittests.cc
FILE: ../../../flutter/shell/common/fixtures/shell_test.dart
FILE: ../../../flutter/shell/common/fixtures/shelltest_screenshot.png
FILE: ../../../flutter/shell/common/input_events_unittests.cc
FILE: ../../../flutter/shell/common/persistent_cache.cc
FILE: ../../../flutter/shell/common/persistent_cache.h
FILE: ../../../flutter/shell/common/persistent_cache_unittests.cc
FILE: ../../../flutter/shell/common/pipeline.cc
FILE: ../../../flutter/shell/common/pipeline.h
Expand Down
30 changes: 30 additions & 0 deletions common/graphics/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//flutter/common/config.gni")
import("//flutter/testing/testing.gni")

source_set("graphics") {
sources = [
"gl_context_switch.cc",
"gl_context_switch.h",
"persistent_cache.cc",
"persistent_cache.h",
"texture.cc",
"texture.h",
]

# Heed caution when adding targets to the dependencies. This is a minimal
# target containing graphics sources that embedders can depend on. Any
# additions here could result in added app sizes across embeddings.
deps = [
"//flutter/assets",
"//flutter/fml",
"//flutter/shell/version:version",
"//third_party/rapidjson",
"//third_party/skia",
]

public_configs = [ "//flutter:config" ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/flow/gl_context_switch.h"
#include "flutter/common/graphics/gl_context_switch.h"

namespace flutter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_FLOW_GL_CONTEXT_SWITCH_H_
#define FLUTTER_FLOW_GL_CONTEXT_SWITCH_H_
#ifndef FLUTTER_COMMON_GRAPHICS_GL_CONTEXT_SWITCH_H_
#define FLUTTER_COMMON_GRAPHICS_GL_CONTEXT_SWITCH_H_

#include <functional>
#include <memory>
Expand Down Expand Up @@ -111,4 +111,4 @@ class GLContextSwitch final : public GLContextResult {

} // namespace flutter

#endif // FLUTTER_FLOW_GL_CONTEXT_SWITCH_H_
#endif // FLUTTER_COMMON_GRAPHICS_GL_CONTEXT_SWITCH_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/shell/common/persistent_cache.h"
#include "flutter/common/graphics/persistent_cache.h"

#include <future>
#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_SHELL_COMMON_PERSISTENT_CACHE_H_
#define FLUTTER_SHELL_COMMON_PERSISTENT_CACHE_H_
#ifndef FLUTTER_COMMON_GRAPHICS_PERSISTENT_CACHE_H_
#define FLUTTER_COMMON_GRAPHICS_PERSISTENT_CACHE_H_

#include <memory>
#include <mutex>
Expand Down Expand Up @@ -134,4 +134,4 @@ class PersistentCache : public GrContextOptions::PersistentCache {

} // namespace flutter

#endif // FLUTTER_SHELL_COMMON_PERSISTENT_CACHE_H_
#endif // FLUTTER_COMMON_GRAPHICS_PERSISTENT_CACHE_H_
2 changes: 1 addition & 1 deletion flow/texture.cc → common/graphics/texture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/flow/texture.h"
#include "flutter/common/graphics/texture.h"

namespace flutter {

Expand Down
6 changes: 3 additions & 3 deletions flow/texture.h → common/graphics/texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_FLOW_TEXTURE_H_
#define FLUTTER_FLOW_TEXTURE_H_
#ifndef FLUTTER_COMMON_GRAPHICS_TEXTURE_H_
#define FLUTTER_COMMON_GRAPHICS_TEXTURE_H_

#include <map>

Expand Down Expand Up @@ -74,4 +74,4 @@ class TextureRegistry {

} // namespace flutter

#endif // FLUTTER_FLOW_TEXTURE_H_
#endif // FLUTTER_COMMON_GRAPHICS_TEXTURE_H_
11 changes: 6 additions & 5 deletions flow/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ source_set("flow") {
"compositor_context.h",
"embedded_views.cc",
"embedded_views.h",
"gl_context_switch.cc",
"gl_context_switch.h",
"instrumentation.cc",
"instrumentation.h",
"layers/backdrop_filter_layer.cc",
Expand Down Expand Up @@ -66,14 +64,13 @@ source_set("flow") {
"surface.h",
"surface_frame.cc",
"surface_frame.h",
"texture.cc",
"texture.h",
]

public_configs = [ "//flutter:config" ]

deps = [
"//flutter/common",
"//flutter/common/graphics",
"//flutter/fml",
"//third_party/skia",
]
Expand Down Expand Up @@ -124,7 +121,10 @@ if (enable_unittests) {
"//third_party/googletest:gtest",
]

deps = [ ":flow" ]
deps = [
":flow",
"//flutter/common/graphics",
]
}

executable("flow_unittests") {
Expand Down Expand Up @@ -167,6 +167,7 @@ if (enable_unittests) {
":flow",
":flow_fixtures",
":flow_testing",
"//flutter/common/graphics",
"//flutter/fml",
"//flutter/testing:skia",
"//flutter/testing:testing_lib",
Expand Down
2 changes: 1 addition & 1 deletion flow/compositor_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include <memory>
#include <string>

#include "flutter/common/graphics/texture.h"
#include "flutter/flow/embedded_views.h"
#include "flutter/flow/instrumentation.h"
#include "flutter/flow/raster_cache.h"
#include "flutter/flow/texture.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/raster_thread_merger.h"
#include "third_party/skia/include/core/SkCanvas.h"
Expand Down
2 changes: 1 addition & 1 deletion flow/gl_context_switch_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// found in the LICENSE file.
#define FML_USED_ON_EMBEDDER

#include "flutter/flow/gl_context_switch.h"
#include "flutter/common/graphics/gl_context_switch.h"

#include <functional>
#include <future>
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include <memory>
#include <vector>

#include "flutter/common/graphics/texture.h"
#include "flutter/flow/embedded_views.h"
#include "flutter/flow/instrumentation.h"
#include "flutter/flow/raster_cache.h"
#include "flutter/flow/texture.h"
#include "flutter/fml/build_config.h"
#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/logging.h"
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/texture_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

#include "flutter/flow/texture.h"
#include "flutter/common/graphics/texture.h"

namespace flutter {

Expand Down
2 changes: 1 addition & 1 deletion flow/surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include <memory>

#include "flutter/common/graphics/gl_context_switch.h"
#include "flutter/flow/embedded_views.h"
#include "flutter/flow/gl_context_switch.h"
#include "flutter/flow/surface_frame.h"
#include "flutter/fml/macros.h"

Expand Down
2 changes: 1 addition & 1 deletion flow/surface_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <memory>

#include "flutter/flow/gl_context_switch.h"
#include "flutter/common/graphics/gl_context_switch.h"
#include "flutter/fml/macros.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkSurface.h"
Expand Down
2 changes: 1 addition & 1 deletion flow/testing/gl_context_switch_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef FLUTTER_SHELL_RENDERER_CONTEXT_TEST_H_
#define FLUTTER_SHELL_RENDERER_CONTEXT_TEST_H_

#include "flutter/flow/gl_context_switch.h"
#include "flutter/common/graphics/gl_context_switch.h"
#include "gtest/gtest.h"

namespace flutter {
Expand Down
2 changes: 1 addition & 1 deletion flow/testing/mock_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <ostream>
#include <vector>

#include "flutter/flow/texture.h"
#include "flutter/common/graphics/texture.h"
#include "flutter/testing/assertions_skia.h"

namespace flutter {
Expand Down
2 changes: 1 addition & 1 deletion flow/texture_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/flow/texture.h"
#include "flutter/common/graphics/texture.h"

#include "flutter/flow/testing/mock_texture.h"
#include "gtest/gtest.h"
Expand Down
5 changes: 3 additions & 2 deletions shell/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ source_set("common") {
"display_manager.h",
"engine.cc",
"engine.h",
"persistent_cache.cc",
"persistent_cache.h",
"pipeline.cc",
"pipeline.h",
"platform_view.cc",
Expand Down Expand Up @@ -111,6 +109,7 @@ source_set("common") {
deps = [
"//flutter/assets",
"//flutter/common",
"//flutter/common/graphics",
"//flutter/flow",
"//flutter/fml",
"//flutter/lib/ui",
Expand Down Expand Up @@ -189,6 +188,7 @@ if (enable_unittests) {
]

public_deps = [
"//flutter/common/graphics",
"//flutter/flow",
"//flutter/fml/dart",
"//flutter/runtime",
Expand Down Expand Up @@ -253,6 +253,7 @@ if (enable_unittests) {
":shell_test_fixture_sources",
":shell_unittests_fixtures",
"//flutter/assets",
"//flutter/common/graphics",
"//flutter/shell/version",
"//third_party/googletest:gmock",
]
Expand Down
2 changes: 1 addition & 1 deletion shell/common/persistent_cache_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/shell/common/persistent_cache.h"
#include "flutter/common/graphics/persistent_cache.h"

#include <memory>

Expand Down
2 changes: 1 addition & 1 deletion shell/common/platform_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include <memory>

#include "flow/embedded_views.h"
#include "flutter/common/graphics/texture.h"
#include "flutter/common/task_runners.h"
#include "flutter/flow/surface.h"
#include "flutter/flow/texture.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/memory/weak_ptr.h"
#include "flutter/lib/ui/semantics/custom_accessibility_action.h"
Expand Down
2 changes: 1 addition & 1 deletion shell/common/rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

#include <utility>

#include "flutter/common/graphics/persistent_cache.h"
#include "flutter/fml/time/time_delta.h"
#include "flutter/fml/time/time_point.h"
#include "flutter/shell/common/persistent_cache.h"
#include "flutter/shell/common/serialization_callbacks.h"
#include "third_party/skia/include/core/SkEncodedImageFormat.h"
#include "third_party/skia/include/core/SkImageEncoder.h"
Expand Down
2 changes: 1 addition & 1 deletion shell/common/run_configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#include <sstream>

#include "flutter/assets/directory_asset_bundle.h"
#include "flutter/common/graphics/persistent_cache.h"
#include "flutter/fml/file.h"
#include "flutter/fml/unique_fd.h"
#include "flutter/runtime/dart_vm.h"
#include "flutter/shell/common/persistent_cache.h"

namespace flutter {

Expand Down
2 changes: 1 addition & 1 deletion shell/common/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <vector>

#include "flutter/assets/directory_asset_bundle.h"
#include "flutter/common/graphics/persistent_cache.h"
#include "flutter/fml/file.h"
#include "flutter/fml/icu_util.h"
#include "flutter/fml/log_settings.h"
Expand All @@ -21,7 +22,6 @@
#include "flutter/fml/unique_fd.h"
#include "flutter/runtime/dart_vm.h"
#include "flutter/shell/common/engine.h"
#include "flutter/shell/common/persistent_cache.h"
#include "flutter/shell/common/skia_event_tracer_impl.h"
#include "flutter/shell/common/switches.h"
#include "flutter/shell/common/vsync_waiter.h"
Expand Down
2 changes: 1 addition & 1 deletion shell/common/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#include <unordered_map>

#include "flutter/assets/directory_asset_bundle.h"
#include "flutter/common/graphics/texture.h"
#include "flutter/common/settings.h"
#include "flutter/common/task_runners.h"
#include "flutter/flow/surface.h"
#include "flutter/flow/texture.h"
#include "flutter/fml/closure.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/memory/ref_ptr.h"
Expand Down
2 changes: 1 addition & 1 deletion shell/common/shell_io_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

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

#include "flutter/common/graphics/persistent_cache.h"
#include "flutter/fml/build_config.h"
#include "flutter/fml/message_loop.h"
#include "flutter/shell/common/persistent_cache.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"

namespace flutter {
Expand Down
Loading

0 comments on commit caf678d

Please sign in to comment.