| # Copyright 2021 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| if (is_android) { |
| import("//build/config/android/rules.gni") |
| } |
| import("//components/optimization_guide/features.gni") |
| |
| static_library("browser") { |
| sources = [ |
| "optimization_guide_decider.h", |
| "page_content_annotations_service.cc", |
| "page_content_annotations_service.h", |
| "page_content_annotations_web_contents_helper.cc", |
| "page_content_annotations_web_contents_helper.h", |
| "page_text_dump_result.cc", |
| "page_text_dump_result.h", |
| "page_text_observer.cc", |
| "page_text_observer.h", |
| ] |
| if (build_with_tflite_lib) { |
| sources += [ |
| "base_model_executor.h", |
| "base_model_executor_helpers.h", |
| "bert_model_executor.cc", |
| "bert_model_executor.h", |
| "model_executor.h", |
| "page_content_annotations_model_manager.cc", |
| "page_content_annotations_model_manager.h", |
| ] |
| } |
| |
| public_deps = [ |
| "//base", |
| "//components/history/core/browser", |
| "//components/keyed_service/core", |
| "//components/optimization_guide:machine_learning_tflite_buildflags", |
| "//components/optimization_guide/content/mojom:mojo_interfaces", |
| "//components/optimization_guide/core", |
| "//components/optimization_guide/proto:optimization_guide_proto", |
| "//content/public/browser", |
| ] |
| if (build_with_tflite_lib) { |
| public_deps += [ |
| "//components/optimization_guide/core:machine_learning", |
| "//third_party/tflite", |
| "//third_party/tflite:tflite_public_headers", |
| "//third_party/tflite-support", |
| "//third_party/tflite-support:tflite-support-proto", |
| ] |
| } |
| } |
| |
| static_library("test_support") { |
| testonly = true |
| sources = [ |
| "test_optimization_guide_decider.cc", |
| "test_optimization_guide_decider.h", |
| ] |
| deps = [ |
| ":browser", |
| "//content/public/browser", |
| "//testing/gtest", |
| ] |
| } |
| |
| source_set("unit_tests") { |
| testonly = true |
| sources = [ |
| "page_content_annotations_web_contents_helper_unittest.cc", |
| "page_text_dump_result_unittest.cc", |
| "page_text_observer_unittest.cc", |
| ] |
| if (build_with_tflite_lib) { |
| sources += [ |
| "bert_model_executor_unittest.cc", |
| "model_executor_unittest.cc", |
| "page_content_annotations_model_manager_unittest.cc", |
| ] |
| } |
| deps = [ |
| ":browser", |
| ":test_support", |
| "//content/test:test_support", |
| "//testing/gmock", |
| "//testing/gtest", |
| ] |
| if (build_with_tflite_lib) { |
| deps += [ |
| "//third_party/tflite", |
| "//third_party/tflite:tflite_public_headers", |
| "//third_party/tflite-support", |
| "//third_party/tflite-support:tflite-support-proto", |
| ] |
| } |
| } |
| |
| if (is_android) { |
| java_cpp_enum("optimization_guide_generated_enums") { |
| sources = [ "optimization_guide_decider.h" ] |
| visibility = [ "//chrome/browser/optimization_guide/android:*" ] |
| } |
| } |