[M120 Migration] Set IO|GPU thread type with higher priorites
[platform/framework/web/chromium-efl.git] / gin / BUILD.gn
1 # Copyright 2014 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 if (is_android) {
6   import("//build/config/android/rules.gni")
7 }
8 import("//base/allocator/partition_allocator/partition_alloc.gni")
9 import("//testing/test.gni")
10 import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
11 import("//v8/gni/v8.gni")
12
13 component("gin") {
14   sources = [
15     "arguments.cc",
16     "arguments.h",
17     "array_buffer.cc",
18     "array_buffer.h",
19     "context_holder.cc",
20     "converter.cc",
21     "converter.h",
22     "cppgc.cc",
23     "data_object_builder.cc",
24     "data_object_builder.h",
25     "debug_impl.cc",
26     "debug_impl.h",
27     "dictionary.cc",
28     "dictionary.h",
29     "function_template.cc",
30     "function_template.h",
31     "gin_export.h",
32     "gin_features.cc",
33     "gin_features.h",
34     "handle.h",
35     "interceptor.cc",
36     "interceptor.h",
37     "isolate_holder.cc",
38     "modules/console.cc",
39     "modules/console.h",
40     "object_template_builder.cc",
41     "object_template_builder.h",
42     "per_context_data.cc",
43     "per_context_data.h",
44     "per_isolate_data.cc",
45     "per_isolate_data.h",
46     "public/context_holder.h",
47     "public/cppgc.h",
48     "public/debug.h",
49     "public/gin_embedders.h",
50     "public/isolate_holder.h",
51     "public/v8_idle_task_runner.h",
52     "public/v8_platform.h",
53     "public/wrapper_info.h",
54     "runner.cc",
55     "runner.h",
56     "shell_runner.cc",
57     "shell_runner.h",
58     "thread_isolation.cc",
59     "thread_isolation.h",
60     "time_clamper.cc",
61     "time_clamper.h",
62     "try_catch.cc",
63     "try_catch.h",
64     "v8_foreground_task_runner.cc",
65     "v8_foreground_task_runner.h",
66     "v8_foreground_task_runner_base.cc",
67     "v8_foreground_task_runner_base.h",
68     "v8_foreground_task_runner_with_locker.cc",
69     "v8_foreground_task_runner_with_locker.h",
70     "v8_initializer.cc",
71     "v8_initializer.h",
72     "v8_isolate_memory_dump_provider.cc",
73     "v8_isolate_memory_dump_provider.h",
74     "v8_platform.cc",
75     "v8_shared_memory_dump_provider.cc",
76     "v8_shared_memory_dump_provider.h",
77     "wrappable.cc",
78     "wrappable.h",
79     "wrapper_info.cc",
80   ]
81
82   if (use_partition_alloc) {
83     sources += [
84       "v8_platform_page_allocator.cc",
85       "v8_platform_page_allocator.h",
86     ]
87     if (enable_pkeys) {
88       sources += [
89         "v8_platform_thread_isolated_allocator.cc",
90         "v8_platform_thread_isolated_allocator.h",
91       ]
92     }
93   }
94
95   if (v8_use_external_startup_data) {
96     data = [ "$root_out_dir/snapshot_blob.bin" ]
97     sources += [ "public/v8_snapshot_file_type.h" ]
98   }
99
100   defines = [ "GIN_IMPLEMENTATION" ]
101
102   public_deps = [
103     "//base",
104     "//base/allocator:buildflags",
105     "//v8",
106   ]
107   deps = [
108     "//base/third_party/dynamic_annotations",
109     "//third_party/abseil-cpp:absl",
110     "//tools/v8_context_snapshot:buildflags",
111   ]
112
113   if (is_mac) {
114     frameworks = [ "CoreFoundation.framework" ]
115   }
116
117   configs += [ "//v8:external_startup_data" ]
118 }
119
120 executable("gin_shell") {
121   sources = [ "shell/gin_main.cc" ]
122
123   deps = [
124     ":gin",
125     "//base",
126     "//base:i18n",
127     "//build/win:default_exe_manifest",
128     "//v8",
129   ]
130
131   configs += [ "//v8:external_startup_data" ]
132 }
133
134 if (is_android && enable_java_templates &&
135     current_toolchain == default_toolchain) {
136   android_assets("v8_snapshot_assets") {
137     if (v8_use_external_startup_data) {
138       disable_compression = true
139       if (use_v8_context_snapshot) {
140         deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
141         sources = [ "$root_build_dir/$v8_context_snapshot_filename" ]
142       } else {
143         if (current_cpu == "arm" || current_cpu == "x86") {
144           _arch_suffix = "32"
145         } else {
146           _arch_suffix = "64"
147         }
148         renaming_sources = [ "$root_build_dir/snapshot_blob.bin" ]
149         renaming_destinations = [ "snapshot_blob_$_arch_suffix.bin" ]
150         deps = [ "//v8:run_mksnapshot_default" ]
151       }
152     }
153   }
154
155   if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
156     android_assets("v8_snapshot_secondary_abi_assets") {
157       assert(android_64bit_target_cpu,
158              "32-bit targets shouldn't have secondary abi")
159       disable_compression = true
160       if (use_v8_context_snapshot) {
161         sources = [ "$root_out_dir/v8_context_snapshot_32.bin" ]
162         deps =
163             [ "//tools/v8_context_snapshot($android_secondary_abi_toolchain)" ]
164       } else {
165         _secondary_abi_out_dir =
166             get_label_info("//v8($android_secondary_abi_toolchain)",
167                            "root_out_dir")
168         renaming_sources = [ "$_secondary_abi_out_dir/snapshot_blob.bin" ]
169         renaming_destinations = [ "snapshot_blob_32.bin" ]
170         deps =
171             [ "//v8:run_mksnapshot_default($android_secondary_abi_toolchain)" ]
172       }
173     }
174   }
175 }
176
177 source_set("gin_test") {
178   testonly = true
179   sources = [
180     "test/v8_test.cc",
181     "test/v8_test.h",
182   ]
183
184   public_deps = [
185     ":gin",
186     "//testing/gtest",
187   ]
188   deps = [
189     "//base/test:test_support",
190     "//v8",
191   ]
192
193   configs += [ "//v8:external_startup_data" ]
194 }
195
196 test("gin_unittests") {
197   sources = [
198     "arguments_unittest.cc",
199     "array_buffer_unittest.cc",
200     "converter_unittest.cc",
201     "data_object_builder_unittest.cc",
202     "interceptor_unittest.cc",
203     "per_context_data_unittest.cc",
204     "shell_runner_unittest.cc",
205     "test/run_all_unittests.cc",
206     "time_clamper_unittest.cc",
207     "v8_isolate_memory_dump_provider_unittest.cc",
208     "v8_platform_unittest.cc",
209     "v8_shared_memory_dump_provider_unittest.cc",
210     "wrappable_unittest.cc",
211   ]
212
213   deps = [
214     ":gin_test",
215     "//base/test:test_support",
216     "//testing/gmock",
217     "//testing/gtest",
218     "//v8",
219   ]
220
221   if (use_partition_alloc) {
222     sources += [ "v8_platform_page_allocator_unittest.cc" ]
223     if (target_cpu == "arm64" && (is_linux || is_android)) {
224       deps += [ "//base:arm_bti_testfunctions" ]
225     }
226   }
227
228   configs += [ "//v8:external_startup_data" ]
229
230   data_deps = [
231     "//testing/buildbot/filters:gin_unittests_filters",
232     "//tools/v8_context_snapshot:v8_context_snapshot",
233   ]
234   data = []
235
236   # gin_shell is not an Android/iOS app.
237   if (!is_android && !is_ios) {
238     sources += [ "shell/gin_shell_unittest.cc" ]
239     deps += [ ":gin_shell" ]
240     data_deps += [ ":gin_shell" ]
241     data += [ "shell/hello_world.js" ]
242   }
243
244   # On Android, the APK must bundle the startup data.
245   if (is_android) {
246     deps += [ ":v8_snapshot_assets" ]
247   }
248
249   if (is_fuchsia) {
250     additional_manifest_fragments =
251         [ "//build/config/fuchsia/test/mark_vmo_executable.shard.test-cml" ]
252   }
253 }