[Cronet] Delay StartNetLog and StopNetLog until native request context is initialized
[chromium-blink-merge.git] / ui / gfx / BUILD.gn
blob467c420db5964ec73f11f4678c4813c6f9cbe642
1 # Copyright 2014 The Chromium 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.
5 import("//build/config/ui.gni")
6 import("//testing/test.gni")
8 if (is_android) {
9   import("//build/config/android/config.gni")
10   import("//build/config/android/rules.gni")
13 # Several targets want to include this header file, and some of them are
14 # child dependencies of "gfx". Therefore, we separate it out here so multiple
15 # targets can all have a dependency for header checking purposes without
16 # creating circular dependencies.
17 source_set("gfx_export") {
18   sources = [
19     "gfx_export.h",
20   ]
23 component("gfx") {
24   sources = [
25     "android/device_display_info.cc",
26     "android/device_display_info.h",
27     "android/gfx_jni_registrar.cc",
28     "android/gfx_jni_registrar.h",
29     "android/java_bitmap.cc",
30     "android/java_bitmap.h",
31     "android/shared_device_display_info.cc",
32     "android/shared_device_display_info.h",
33     "android/view_configuration.cc",
34     "android/view_configuration.h",
35     "animation/animation.cc",
36     "animation/animation.h",
37     "animation/animation_container.cc",
38     "animation/animation_container.h",
39     "animation/animation_container_element.h",
40     "animation/animation_container_observer.h",
41     "animation/animation_delegate.h",
42     "animation/linear_animation.cc",
43     "animation/linear_animation.h",
44     "animation/multi_animation.cc",
45     "animation/multi_animation.h",
46     "animation/slide_animation.cc",
47     "animation/slide_animation.h",
48     "animation/throb_animation.cc",
49     "animation/throb_animation.h",
50     "animation/tween.cc",
51     "animation/tween.h",
52     "blit.cc",
53     "blit.h",
54     "break_list.h",
55     "canvas.cc",
56     "canvas.h",
57     "canvas_notimplemented.cc",
58     "canvas_paint_mac.h",
59     "canvas_paint_mac.mm",
60     "canvas_paint_win.cc",
61     "canvas_paint_win.h",
62     "canvas_skia.cc",
63     "canvas_skia_paint.h",
64     "codec/jpeg_codec.cc",
65     "codec/jpeg_codec.h",
66     "codec/png_codec.cc",
67     "codec/png_codec.h",
68     "color_analysis.cc",
69     "color_analysis.h",
70     "color_profile.cc",
71     "color_profile.h",
72     "color_profile_mac.mm",
73     "color_profile_win.cc",
74     "color_utils.cc",
75     "color_utils.h",
76     "display.cc",
77     "display.h",
78     "display_change_notifier.cc",
79     "display_change_notifier.h",
80     "display_observer.cc",
81     "display_observer.h",
82     "favicon_size.cc",
83     "favicon_size.h",
84     "font.cc",
85     "font.h",
86     "font_fallback.h",
87     "font_fallback_linux.cc",
88     "font_fallback_mac.mm",
89     "font_fallback_win.cc",
90     "font_fallback_win.h",
91     "font_list.cc",
92     "font_list.h",
93     "font_list_impl.cc",
94     "font_list_impl.h",
95     "font_render_params.cc",
96     "font_render_params.h",
97     "font_render_params_android.cc",
98     "font_render_params_linux.cc",
99     "font_render_params_mac.cc",
100     "font_render_params_win.cc",
101     "frame_time.h",
102     "gdi_util.cc",
103     "gdi_util.h",
104     "gfx_paths.cc",
105     "gfx_paths.h",
106     "gpu_memory_buffer.cc",
107     "gpu_memory_buffer.h",
108     "hud_font.cc",
109     "hud_font.h",
110     "icon_util.cc",
111     "icon_util.h",
112     "image/canvas_image_source.cc",
113     "image/canvas_image_source.h",
114     "image/image.cc",
115     "image/image.h",
116     "image/image_family.cc",
117     "image/image_family.h",
118     "image/image_ios.mm",
119     "image/image_mac.mm",
120     "image/image_png_rep.cc",
121     "image/image_png_rep.h",
122     "image/image_skia.cc",
123     "image/image_skia.h",
124     "image/image_skia_operations.cc",
125     "image/image_skia_operations.h",
126     "image/image_skia_rep.cc",
127     "image/image_skia_rep.h",
128     "image/image_skia_source.h",
129     "image/image_skia_util_ios.h",
130     "image/image_skia_util_ios.mm",
131     "image/image_skia_util_mac.h",
132     "image/image_skia_util_mac.mm",
133     "image/image_util.cc",
134     "image/image_util.h",
135     "image/image_util_ios.mm",
136     "interpolated_transform.cc",
137     "interpolated_transform.h",
138     "linux_font_delegate.cc",
139     "linux_font_delegate.h",
140     "mac/coordinate_conversion.h",
141     "mac/coordinate_conversion.mm",
142     "mac/scoped_ns_disable_screen_updates.h",
143     "native_widget_types.h",
144     "nine_image_painter.cc",
145     "nine_image_painter.h",
146     "path.cc",
147     "path.h",
148     "path_aura.cc",
149     "path_win.cc",
150     "path_win.h",
151     "path_x11.cc",
152     "path_x11.h",
153     "platform_font.h",
154     "platform_font_android.cc",
155     "platform_font_ios.h",
156     "platform_font_ios.mm",
157     "platform_font_linux.cc",
158     "platform_font_linux.h",
159     "platform_font_mac.h",
160     "platform_font_mac.mm",
161     "platform_font_win.cc",
162     "platform_font_win.h",
163     "range/range.cc",
164     "range/range.h",
165     "range/range_f.cc",
166     "range/range_f.h",
167     "range/range_mac.mm",
168     "range/range_win.cc",
169     "scoped_canvas.h",
170     "scoped_cg_context_save_gstate_mac.h",
171     "scoped_ns_graphics_context_save_gstate_mac.h",
172     "scoped_ns_graphics_context_save_gstate_mac.mm",
173     "scoped_ui_graphics_push_context_ios.h",
174     "scoped_ui_graphics_push_context_ios.mm",
175     "screen.cc",
176     "screen.h",
177     "screen_android.cc",
178     "screen_aura.cc",
179     "screen_ios.mm",
180     "screen_mac.mm",
181     "screen_win.cc",
182     "screen_win.h",
183     "scrollbar_size.cc",
184     "scrollbar_size.h",
185     "selection_model.cc",
186     "selection_model.h",
187     "sequential_id_generator.cc",
188     "sequential_id_generator.h",
189     "shadow_value.cc",
190     "shadow_value.h",
191     "skbitmap_operations.cc",
192     "skbitmap_operations.h",
193     "skia_util.cc",
194     "skia_util.h",
195     "switches.cc",
196     "switches.h",
197     "sys_color_change_listener.cc",
198     "sys_color_change_listener.h",
199     "text_constants.h",
200     "text_elider.cc",
201     "text_elider.h",
202     "text_utils.cc",
203     "text_utils.h",
204     "text_utils_android.cc",
205     "text_utils_ios.mm",
206     "transform.cc",
207     "transform.h",
208     "transform_util.cc",
209     "transform_util.h",
210     "ui_gfx_exports.cc",
211     "utf16_indexing.cc",
212     "utf16_indexing.h",
213     "vsync_provider.h",
214     "win/direct_write.cc",
215     "win/direct_write.h",
216     "win/dpi.cc",
217     "win/dpi.h",
218     "win/hwnd_util.cc",
219     "win/hwnd_util.h",
220     "win/scoped_set_map_mode.h",
221     "win/singleton_hwnd.cc",
222     "win/singleton_hwnd.h",
223     "win/window_impl.cc",
224     "win/window_impl.h",
225   ]
227   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
228   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
230   defines = [ "GFX_IMPLEMENTATION" ]
232   deps = [
233     ":gfx_export",
234     "//base",
235     "//base:i18n",
236     "//base:base_static",
237     "//base/third_party/dynamic_annotations",
238     "//skia",
239     "//third_party/harfbuzz-ng",
240     "//third_party/libpng",
241     "//third_party/zlib",
242     "//ui/gfx/geometry",
243   ]
244   public_deps = [
245     "//base",
246     "//skia",
247     "//third_party/icu",
248   ]
250   # Text rendering conditions (complicated so separated out).
251   if (is_android || is_ios) {
252     # We don't support RenderText on these platforms.
253   } else {
254     # Mac doesn't use RenderTextHarfBuzz by default yet.
255     sources += [
256       "harfbuzz_font_skia.cc",
257       "harfbuzz_font_skia.h",
258       "render_text.cc",
259       "render_text.h",
260       "render_text_harfbuzz.cc",
261       "render_text_harfbuzz.h",
262       "render_text_mac.cc",
263       "render_text_mac.h",
264       "text_utils_skia.cc",
265     ]
266   }
268   # iOS.
269   if (is_ios) {
270     sources -= [
271       "codec/jpeg_codec.cc",
272       "codec/jpeg_codec.h",
273     ]
274   } else {
275     deps += [ "//third_party:jpeg" ]
276   }
278   # Android.
279   if (is_android) {
280     sources -= [
281       "animation/throb_animation.cc",
282       "canvas_skia.cc",
283       "selection_model.cc",
284     ]
286     if (use_aura) {
287       sources -= [ "screen_android.cc" ]
288     } else {
289       sources -= [ "path.cc" ]
290     }
292     if (!is_android_webview_build) {
293       deps += [ "//base:base_java" ]
294     }
296     if (!is_debug) {
297       configs -= [ "//build/config/compiler:optimize" ]
298       configs += [ "//build/config/compiler:optimize_max" ]
299     }
301     deps += [ ":gfx_jni_headers" ]
302     libs = [
303       "android",
304       "jnigraphics",
305     ]
306   } else {
307     sources -= [ "canvas_notimplemented.cc" ]
308   }
310   # Windows.
311   if (is_win) {
312     cflags = [ "/wd4324" ]  # Structure was padded due to __declspec(align()), which is
313                             # uninteresting.
314   } else {
315     sources -= [
316       "gdi_util.cc",
317       "gdi_util.h",
318       "icon_util.cc",
319       "icon_util.h",
320     ]
321   }
323   # Linux.
324   if (is_linux) {
325     configs += [ "//build/config/linux:fontconfig" ]
326   }
328   if (!use_aura) {
329     sources -= [
330       "path_aura.cc",
331       "screen_aura.cc",
332     ]
333     if (!toolkit_views) {
334       sources -= [
335         "nine_image_painter.cc",
336         "nine_image_painter.h",
337       ]
338     }
339   }
341   if (use_x11) {
342     deps += [ "//ui/gfx/x" ]
343     configs += [ "//build/config/linux:x11" ]
344   } else {
345     sources -= [ "path_x11.cc" ]
346   }
348   if (use_cairo) {
349     configs += [ "//build/config/linux:pangocairo" ]
350   }
353 # Looking for gfx_geometry? It's //ui/gfx/geometry:geometry
355 source_set("test_support") {
356   testonly = true
357   sources = [
358     "image/image_unittest_util.cc",
359     "image/image_unittest_util.h",
360     "image/image_unittest_util_ios.mm",
361     "image/image_unittest_util_mac.mm",
362     "test/fontconfig_util_linux.cc",
363     "test/fontconfig_util_linux.h",
364     "test/gfx_util.cc",
365     "test/gfx_util.h",
366     "test/ui_cocoa_test_helper.h",
367     "test/ui_cocoa_test_helper.mm",
368   ]
370   public_deps = [
371     ":gfx",
372   ]
374   deps = [
375     "//base",
376     "//base/test:test_support",
377     "//skia",
378     "//testing/gtest",
379     "//ui/gfx/geometry",
380   ]
382   if (is_ios) {
383     # The cocoa files don't apply to iOS.
384     sources -= [
385       "test/ui_cocoa_test_helper.h",
386       "test/ui_cocoa_test_helper.mm",
387     ]
388   }
389   if (is_linux) {
390     configs += [ "//build/config/linux:fontconfig" ]
391   }
394 test("gfx_unittests") {
395   sources = [
396     "font_render_params_linux_unittest.cc",
397     "font_unittest.cc",
398     "image/image_family_unittest.cc",
399     "image/image_ios_unittest.mm",
400     "image/image_skia_unittest.cc",
401     "image/image_unittest.cc",
402     "platform_font_linux_unittest.cc",
403     "screen_unittest.cc",
404     "test/run_all_unittests.cc",
405     "text_elider_unittest.cc",
406     "text_utils_unittest.cc",
407   ]
409   if (!is_ios) {
410     sources += [
411       "animation/animation_container_unittest.cc",
412       "animation/animation_unittest.cc",
413       "animation/multi_animation_unittest.cc",
414       "animation/slide_animation_unittest.cc",
415       "animation/tween_unittest.cc",
416       "blit_unittest.cc",
417       "break_list_unittest.cc",
418       "canvas_unittest.cc",
419       "canvas_unittest_mac.mm",
420       "codec/jpeg_codec_unittest.cc",
421       "codec/png_codec_unittest.cc",
422       "color_analysis_unittest.cc",
423       "color_profile_mac_unittest.mm",
424       "color_utils_unittest.cc",
425       "display_change_notifier_unittest.cc",
426       "display_unittest.cc",
427       "font_fallback_mac_unittest.cc",
428       "font_list_unittest.cc",
429       "geometry/box_unittest.cc",
430       "geometry/cubic_bezier_unittest.cc",
431       "geometry/insets_unittest.cc",
432       "geometry/matrix3_unittest.cc",
433       "geometry/point3_unittest.cc",
434       "geometry/point_unittest.cc",
435       "geometry/quad_unittest.cc",
436       "geometry/r_tree_unittest.cc",
437       "geometry/rect_unittest.cc",
438       "geometry/safe_integer_conversions_unittest.cc",
439       "geometry/scroll_offset_unittest.cc",
440       "geometry/size_unittest.cc",
441       "geometry/vector2d_unittest.cc",
442       "geometry/vector3d_unittest.cc",
443       "image/image_mac_unittest.mm",
444       "image/image_util_unittest.cc",
445       "mac/coordinate_conversion_unittest.mm",
446       "nine_image_painter_unittest.cc",
447       "platform_font_mac_unittest.mm",
448       "range/range_mac_unittest.mm",
449       "range/range_unittest.cc",
450       "range/range_win_unittest.cc",
451       "render_text_unittest.cc",
452       "sequential_id_generator_unittest.cc",
453       "shadow_value_unittest.cc",
454       "skbitmap_operations_unittest.cc",
455       "skrect_conversion_unittest.cc",
456       "transform_util_unittest.cc",
457       "utf16_indexing_unittest.cc",
458     ]
459   }
461   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
462   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
464   deps = [
465     ":gfx",
466     ":test_support",
467     "//base",
468     "//base/test:test_support",
469     "//skia",
470     "//third_party/icu:icuuc",
471     "//third_party/libpng",
472     "//third_party/zlib",
473     "//testing/gtest",
474     "//ui/base",
475     "//ui/gfx/geometry",
476     "//ui/resources:ui_test_pak",
477   ]
479   if (!is_mac && !is_ios) {
480     sources += [
481       "interpolated_transform_unittest.cc",
482       "transform_unittest.cc",
483     ]
484   }
486   if (is_android) {
487     sources -= [
488       # Do not run display_change_notifier_unittest.cc on Android because it
489       # does not compile display_observer.cc
490       "display_change_notifier_unittest.cc",
491     ]
492   }
494   if (is_android || is_ios) {
495     sources -= [ "render_text_unittest.cc" ]
496   }
498   if (use_aura) {
499     sources -= [ "screen_unittest.cc" ]
500   } else {
501     sources -= [ "nine_image_painter_unittest.cc" ]
502   }
504   if (is_win) {
505     sources += [
506       "color_profile_win_unittest.cc",
507       "font_fallback_win_unittest.cc",
508       "icon_util_unittest.cc",
509       "icon_util_unittests.rc",
510       "path_win_unittest.cc",
511       "platform_font_win_unittest.cc",
512     ]
514     ldflags = [
515       "/DELAYLOAD:d2d1.dll",
516       "/DELAYLOAD:d3d10_1.dll",
517     ]
519     libs = [
520       "d2d1.lib",
521       "d3d10_1.lib",
522       "imm32.lib",
523       "oleacc.lib",
524     ]
525   }
528 if (is_android) {
529   generate_jni("gfx_jni_headers") {
530     sources = [
531       "../android/java/src/org/chromium/ui/gfx/BitmapHelper.java",
532       "../android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java",
533       "../android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java",
534     ]
535     jni_package = "gfx"
536   }