Revert of Revert of Allow creating context for cc worker thread. (patchset #1 id...
[chromium-blink-merge.git] / skia / BUILD.gn
blobe55730f8d486373dd6546f1c1c62fc3295f88244
1 # Copyright (c) 2013 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/features.gni")
6 import("//build/config/ui.gni")
7 import("//testing/test.gni")
8 if (cpu_arch == "arm") {
9   import("//build/config/arm.gni")
12 skia_support_gpu = !is_ios
13 skia_support_pdf = !is_ios && (enable_basic_printing || enable_print_preview)
15 # The list of Skia defines that are to be set for blink.
16 gypi_blink_skia_defines =
17     exec_script("//build/gypi_to_gn.py",
18                 [
19                   rebase_path(
20                       "//third_party/WebKit/public/blink_skia_config.gypi"),
21                   "--replace=<(skia_include_path)=//third_party/skia/include",
22                   "--replace=<(skia_src_path)=//third_party/skia/src",
23                 ],
24                 "scope",
25                 [ "//third_party/WebKit/public/blink_skia_config.gypi" ])
27 # The list of Skia defines that are to be set for chromium.
28 gypi_skia_defines =
29     exec_script("//build/gypi_to_gn.py",
30                 [
31                   rebase_path(
32                       "//third_party/skia/gyp/skia_for_chromium_defines.gypi"),
33                   "--replace=<(skia_include_path)=//third_party/skia/include",
34                   "--replace=<(skia_src_path)=//third_party/skia/src",
35                 ],
36                 "scope",
37                 [ "//third_party/skia/gyp/skia_for_chromium_defines.gypi" ])
39 # The list of Skia core sources that are to be set for chromium.
40 gypi_skia_core =
41     exec_script("//build/gypi_to_gn.py",
42                 [
43                   rebase_path("//third_party/skia/gyp/core.gypi"),
44                   "--replace=<(skia_include_path)=//third_party/skia/include",
45                   "--replace=<(skia_src_path)=//third_party/skia/src",
46                 ],
47                 "scope",
48                 [ "//third_party/skia/gyp/core.gypi" ])
50 # The list of Skia gpu sources that are to be set for chromium.
51 gypi_skia_gpu =
52     exec_script("//build/gypi_to_gn.py",
53                 [
54                   rebase_path("//third_party/skia/gyp/gpu.gypi"),
55                   "--replace=<(skia_include_path)=//third_party/skia/include",
56                   "--replace=<(skia_src_path)=//third_party/skia/src",
57                 ],
58                 "scope",
59                 [ "//third_party/skia/gyp/gpu.gypi" ])
61 # The list of Skia pdf sources that are to be set for chromium.
62 gypi_skia_pdf =
63     exec_script("//build/gypi_to_gn.py",
64                 [
65                   rebase_path("//third_party/skia/gyp/pdf.gypi"),
66                   "--replace=<(skia_include_path)=//third_party/skia/include",
67                   "--replace=<(skia_src_path)=//third_party/skia/src",
68                 ],
69                 "scope",
70                 [ "//third_party/skia/gyp/pdf.gypi" ])
72 # The list of Skia effects that are to be set for chromium.
73 gypi_skia_effects =
74     exec_script("//build/gypi_to_gn.py",
75                 [
76                   rebase_path("//third_party/skia/gyp/effects.gypi"),
77                   "--replace=<(skia_include_path)=//third_party/skia/include",
78                   "--replace=<(skia_src_path)=//third_party/skia/src",
79                 ],
80                 "scope",
81                 [ "//third_party/skia/gyp/effects.gypi" ])
83 # The list of Skia utils that are to be set for chromium.
84 gypi_skia_utils =
85     exec_script("//build/gypi_to_gn.py",
86                 [
87                   rebase_path("//third_party/skia/gyp/utils.gypi"),
88                   "--replace=<(skia_include_path)=//third_party/skia/include",
89                   "--replace=<(skia_src_path)=//third_party/skia/src",
90                 ],
91                 "scope",
92                 [ "//third_party/skia/gyp/utils.gypi" ])
94 gypi_skia_opts =
95     exec_script("//build/gypi_to_gn.py",
96                 [
97                   rebase_path("//third_party/skia/gyp/opts.gypi"),
98                   "--replace=<(skia_include_path)=//third_party/skia/include",
99                   "--replace=<(skia_src_path)=//third_party/skia/src",
100                 ],
101                 "scope",
102                 [ "//third_party/skia/gyp/opts.gypi" ])
104 # The list of Skia files is kept in skia_gn_files.gypi. Read it.
105 gypi_values =
106     exec_script("//build/gypi_to_gn.py",
107                 [
108                   rebase_path("skia_gn_files.gypi"),
109                   "--replace=<(skia_include_path)=//third_party/skia/include",
110                   "--replace=<(skia_src_path)=//third_party/skia/src",
111                 ],
112                 "scope",
113                 [ "skia_gn_files.gypi" ])
115 # External-facing config for dependent code.
116 config("skia_config") {
117   include_dirs = [
118     "config",
119     "ext",
120     "//third_party/skia/include/c",
121     "//third_party/skia/include/config",
122     "//third_party/skia/include/core",
123     "//third_party/skia/include/effects",
124     "//third_party/skia/include/images",
125     "//third_party/skia/include/lazy",
126     "//third_party/skia/include/pathops",
127     "//third_party/skia/include/pdf",
128     "//third_party/skia/include/pipe",
129     "//third_party/skia/include/ports",
130     "//third_party/skia/include/utils",
131     "//third_party/skia/src/core",
132     "//third_party/skia/src/image",
133     "//third_party/skia/src/opts",
134     "//third_party/skia/src/pdf",
135     "//third_party/skia/src/ports",
136     "//third_party/skia/src/sfnt",
137     "//third_party/skia/src/utils",
138     "//third_party/skia/src/lazy",
139   ]
141   defines = gypi_blink_skia_defines.blink_skia_defines
142   defines += gypi_skia_defines.skia_for_chromium_defines
144   defines += [
145     "SK_ENABLE_INST_COUNT=0",
146     "GR_GL_CUSTOM_SETUP_HEADER=\"GrGLConfig_chrome.h\"",
147     "SK_ENABLE_LEGACY_API_ALIASING=1",
148     "SK_ATTR_DEPRECATED=SK_NOTHING_ARG1",
149     "GR_GL_IGNORE_ES3_MSAA=0",
150     "SK_WILL_NEVER_DRAW_PERSPECTIVE_TEXT",
151     "SK_SUPPORT_LEGACY_GETTOTALCLIP",
152   ]
154   if (component_mode == "shared_library") {
155     defines += [ "SKIA_DLL" ]
156   }
158   if (skia_support_gpu) {
159     include_dirs += [
160       "//third_party/skia/include/gpu",
161       "//third_party/skia/src/gpu",
162     ]
163     defines += [ "SK_SUPPORT_GPU=1" ]
164   } else {
165     defines += [ "SK_SUPPORT_GPU=0" ]
166   }
168   # For POSIX platforms, prefer the Mutex implementation provided by Skia
169   # since it does not generate static initializers.
170   if (is_posix) {
171     defines += [ "SK_USE_POSIX_THREADS" ]
172   }
174   if (is_android) {
175     defines += [
176       "SK_BUILD_FOR_ANDROID",
177       "USE_CHROMIUM_SKIA",
178     ]
179   }
181   if (is_mac) {
182     defines += [ "SK_BUILD_FOR_MAC" ]
183   }
186 # Internal-facing config for Skia library code.
187 config("skia_library_config") {
188   # These include directories are only included for Skia code and are not
189   # exported to dependents. It's not clear if this is on purpose, but this
190   # matches the GYP build.
191   include_dirs = []
192   if (is_mac || is_ios) {
193     include_dirs += [ "//third_party/skia/include/utils/mac" ]
194   }
195   if (is_mac) {
196     include_dirs += [ "//third_party/skia/include/utils/ios" ]
197   }
199   defines = [
200     #skia_export_defines ???) TODO
202     # skia uses static initializers to initialize the serialization logic
203     # of its "pictures" library. This is currently not used in chrome; if
204     # it ever gets used the processes that use it need to call
205     # SkGraphics::Init().
206     "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0",
208     # Forcing the unoptimized path for the offset image filter in skia until
209     # all filters used in Blink support the optimized path properly
210     "SK_DISABLE_OFFSETIMAGEFILTER_OPTIMIZATION",
211     "IGNORE_ROT_AA_RECT_OPT",
212     "SK_IGNORE_BLURRED_RRECT_OPT",
214     # this flag forces Skia not to use typographic metrics with GDI.
215     "SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS",
216     "SK_USE_DISCARDABLE_SCALEDIMAGECACHE",
217   ]
219   if (component_mode == "shared_library") {
220     defines += [ "SKIA_IMPLEMENTATION=1" ]
221   }
223   if (cpu_arch == "arm") {
224     if (arm_use_neon) {
225       defines += [ "SK_ARM_HAS_NEON" ]
226     }
227     if (arm_optionally_use_neon) {
228       defines += [ "SK_ARM_HAS_OPTIONAL_NEON" ]
229     }
230   }
232   # Settings for text blitting, chosen to approximate the system browser.
233   if (is_linux) {
234     defines += [
235       "SK_GAMMA_EXPONENT=1.2",
236       "SK_GAMMA_CONTRAST=0.2",
237       "SK_HIGH_QUALITY_IS_LANCZOS",
238     ]
239   } else if (is_android) {
240     defines += [
241       "SK_GAMMA_APPLY_TO_A8",
242       "SK_GAMMA_EXPONENT=1.4",
243       "SK_GAMMA_CONTRAST=0.0",
244     ]
245   } else if (is_win) {
246     defines += [
247       "SK_GAMMA_SRGB",
248       "SK_GAMMA_CONTRAST=0.5",
249       "SK_HIGH_QUALITY_IS_LANCZOS",
250     ]
251   } else if (is_mac) {
252     defines += [
253       "SK_GAMMA_SRGB",
254       "SK_GAMMA_CONTRAST=0.0",
255       "SK_HIGH_QUALITY_IS_LANCZOS",
256     ]
257   }
259   if (is_android) {
260     defines += [
261       # Android devices are typically more memory constrained, so default to a
262       # smaller glyph cache (it may be overriden at runtime when the renderer
263       # starts up, depending on the actual device memory).
264       "SK_DEFAULT_FONT_CACHE_LIMIT=1048576",  # 1024 * 1024
265     ]
266   } else {
267     defines += [ "SK_DEFAULT_FONT_CACHE_LIMIT=20971520" ]  # 20 * 1024 * 1024
268   }
270   if (is_win) {
271     include_dirs = [
272       "//third_party/skia/include/utils/win",
273       "//third_party/skia/src/utils/win",
274     ]
276     defines += [ "SK_FONTHOST_USES_FONTMGR" ]
278     cflags = [
279       "/wd4244",  # conversion from 'type1( __int64)' to 'type2 (unsigned int)'
280       "/wd4267",  # conversion from 'size_t' (64 bit) to 'type'(32 bit).
281       "/wd4341",  # signed value is out of range for enum constant.
282       "/wd4345",  # Object is default-initialized if initialization is omitted.
283       "/wd4390",  # ';'empty statement found in looping;is it what was intended?
284       "/wd4554",  # 'operator' : check operator precedence for possible error
285       "/wd4748",  # compiler will disable optimizations if a function has inline
286                   # assembly code contains flow control(jmp or jcc) statements.
287       "/wd4800",  # forcing value to bool 'true/false'(assigning int to bool).
288     ]
289   }
292 component("skia") {
293   sources = [
294     # Chrome sources.
295     "config/SkUserConfig.h",
296     "ext/analysis_canvas.cc",
297     "ext/analysis_canvas.h",
298     "ext/benchmarking_canvas.cc",
299     "ext/benchmarking_canvas.h",
300     "ext/bitmap_platform_device.h",
301     "ext/convolver.cc",
302     "ext/convolver.h",
303     "ext/event_tracer_impl.cc",
304     "ext/event_tracer_impl.h",
305     "ext/fontmgr_default_win.cc",
306     "ext/fontmgr_default_win.h",
307     "ext/google_logging.cc",
308     "ext/image_operations.cc",
309     "ext/image_operations.h",
310     "ext/opacity_draw_filter.cc",
311     "ext/opacity_draw_filter.h",
312     "ext/pixel_ref_utils.cc",
313     "ext/pixel_ref_utils.h",
314     "ext/platform_canvas.cc",
315     "ext/platform_canvas.h",
316     "ext/platform_device.cc",
317     "ext/platform_device.h",
318     "ext/platform_device_linux.cc",
319     "ext/platform_device_mac.cc",
320     "ext/platform_device_win.cc",
321     "ext/recursive_gaussian_convolution.cc",
322     "ext/recursive_gaussian_convolution.h",
323     "ext/refptr.h",
324     "ext/SkDiscardableMemory_chrome.h",
325     "ext/SkDiscardableMemory_chrome.cc",
326     "ext/SkMemory_new_handler.cpp",
327     "ext/skia_utils_base.cc",
328     "ext/skia_utils_base.h",
329     "ext/skia_utils_ios.mm",
330     "ext/skia_utils_ios.h",
331     "ext/skia_utils_mac.mm",
332     "ext/skia_utils_mac.h",
333     "ext/skia_utils_win.cc",
334     "ext/skia_utils_win.h",
335   ]
337   # The skia gypi values are relative to the skia_dir, so we need to rebase.
338   sources += gypi_skia_core.sources
339   sources += gypi_skia_effects.sources
340   sources += gypi_skia_utils.sources
341   sources += gypi_values.skia_library_sources
343   if (cpu_arch == "arm") {
344     sources += [
345       "//third_party/skia/src/core/SkUtilsArm.cpp",
346       "//third_party/skia/src/core/SkUtilsArm.h",
347     ]
348   }
350   # GPU
351   if (skia_support_gpu) {
352     sources += gypi_skia_gpu.skgpu_sources
353     sources += gypi_skia_gpu.skgpu_null_gl_sources
354   }
356   # Remove unused util files include in utils.gypi
357   sources -= [
358     "//third_party/skia/include/utils/SkBoundaryPatch.h",
359     "//third_party/skia/include/utils/SkFrontBufferedStream.h",
360     "//third_party/skia/include/utils/SkCamera.h",
361     "//third_party/skia/include/utils/SkCanvasStateUtils.h",
362     "//third_party/skia/include/utils/SkCubicInterval.h",
363     "//third_party/skia/include/utils/SkCullPoints.h",
364     "//third_party/skia/include/utils/SkDebugUtils.h",
365     "//third_party/skia/include/utils/SkDumpCanvas.h",
366     "//third_party/skia/include/utils/SkEventTracer.h",
367     "//third_party/skia/include/utils/SkInterpolator.h",
368     "//third_party/skia/include/utils/SkLayer.h",
369     "//third_party/skia/include/utils/SkMeshUtils.h",
370     "//third_party/skia/include/utils/SkNinePatch.h",
371     "//third_party/skia/include/utils/SkParse.h",
372     "//third_party/skia/include/utils/SkParsePaint.h",
373     "//third_party/skia/include/utils/SkParsePath.h",
374     "//third_party/skia/include/utils/SkRandom.h",
375     "//third_party/skia/src/utils/SkBitmapHasher.cpp",
376     "//third_party/skia/src/utils/SkBitmapHasher.h",
377     "//third_party/skia/src/utils/SkBoundaryPatch.cpp",
378     "//third_party/skia/src/utils/SkFrontBufferedStream.cpp",
379     "//third_party/skia/src/utils/SkCamera.cpp",
380     "//third_party/skia/src/utils/SkCanvasStack.h",
381     "//third_party/skia/src/utils/SkCubicInterval.cpp",
382     "//third_party/skia/src/utils/SkCullPoints.cpp",
383     "//third_party/skia/src/utils/SkDumpCanvas.cpp",
384     "//third_party/skia/src/utils/SkFloatUtils.h",
385     "//third_party/skia/src/utils/SkInterpolator.cpp",
386     "//third_party/skia/src/utils/SkLayer.cpp",
387     "//third_party/skia/src/utils/SkMD5.cpp",
388     "//third_party/skia/src/utils/SkMD5.h",
389     "//third_party/skia/src/utils/SkMeshUtils.cpp",
390     "//third_party/skia/src/utils/SkNinePatch.cpp",
391     "//third_party/skia/src/utils/SkOSFile.cpp",
392     "//third_party/skia/src/utils/SkParse.cpp",
393     "//third_party/skia/src/utils/SkParseColor.cpp",
394     "//third_party/skia/src/utils/SkParsePath.cpp",
395     "//third_party/skia/src/utils/SkPathUtils.cpp",
396     "//third_party/skia/src/utils/SkSHA1.cpp",
397     "//third_party/skia/src/utils/SkSHA1.h",
398     "//third_party/skia/src/utils/SkTFitsIn.h",
399     "//third_party/skia/src/utils/SkTLogic.h",
401     # We don't currently need to change thread affinity, so leave out this complexity for now.
402     "//third_party/skia/src/utils/SkThreadUtils_pthread_mach.cpp",
403     "//third_party/skia/src/utils/SkThreadUtils_pthread_linux.cpp",
405     #testing
406     "//third_party/skia/src/fonts/SkGScalerContext.cpp",
407     "//third_party/skia/src/fonts/SkGScalerContext.h",
408   ]
410   if (is_win) {
411     sources -= [
412       # Keeping _win.cpp
413       "//third_party/skia/src/utils/SkThreadUtils_pthread.cpp",
414       "//third_party/skia/src/utils/SkThreadUtils_pthread_other.cpp",
415     ]
416   } else {
417     sources -= [
418       # Keeping _pthread.cpp and _pthread_other.cpp.
419       "//third_party/skia/src/utils/SkThreadUtils_win.cpp",
420     ]
421   }
423   # need separate win section to handle chromes auto gn filter
424   # (build/config/BUILDCONFIG.gn)
425   if (is_win) {
426     sources -= [
427       #windows
428       "//third_party/skia/include/utils/win/SkAutoCoInitialize.h",
429       "//third_party/skia/include/utils/win/SkHRESULT.h",
430       "//third_party/skia/include/utils/win/SkIStream.h",
431       "//third_party/skia/include/utils/win/SkTScopedComPtr.h",
432       "//third_party/skia/src/utils/win/SkAutoCoInitialize.cpp",
433       "//third_party/skia/src/utils/win/SkIStream.cpp",
434       "//third_party/skia/src/utils/win/SkWGL_win.cpp",
435     ]
436   }
438   if (is_android && (!enable_basic_printing && !enable_print_preview)) {
439     sources -= [ "ext/skia_utils_base.cc" ]
440   }
442   # Fixup skia library sources.
443   if (is_win) {
444     sources -= [
445       "//third_party/skia/src/ports/SkOSFile_posix.cpp",
446       "//third_party/skia/src/ports/SkTime_Unix.cpp",
447       "//third_party/skia/src/ports/SkTLS_pthread.cpp",
448     ]
449   } else {
450     sources -= [
451       "//third_party/skia/src/ports/SkFontHost_win.cpp",
452       "//third_party/skia/src/ports/SkFontMgr_win_dw.cpp",
453       "//third_party/skia/src/ports/SkOSFile_win.cpp",
454       "//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp",
455       "//third_party/skia/src/ports/SkScalerContext_win_dw.cpp",
456       "//third_party/skia/src/ports/SkScalerContext_win_dw.h",
457       "//third_party/skia/src/ports/SkTLS_win.cpp",
458       "//third_party/skia/src/ports/SkTypeface_win_dw.cpp",
459       "//third_party/skia/src/ports/SkTypeface_win_dw.h",
460     ]
461   }
462   if (!is_android) {
463     sources -= [
464       "//third_party/skia/src/ports/SkFontConfigParser_android.cpp",
465       "//third_party/skia/src/ports/SkFontMgr_android.cpp",
466     ]
467   }
468   if (!is_mac) {
469     sources -= [ "//third_party/skia/src/ports/SkFontHost_mac.cpp" ]
470   }
472   if (!is_linux) {
473     sources -= [
474       "//third_party/skia/src/ports/SkFontHost_fontconfig.cpp",
475       "//third_party/skia/src/fonts/SkFontMgr_fontconfig.cpp",
476       "//third_party/skia/src/ports/SkFontConfigInterface_direct.cpp",
477     ]
478   }
480   if (!is_linux && !is_android) {
481     sources -= [
482       "//third_party/skia/src/ports/SkFontHost_FreeType_common.cpp",
483       "//third_party/skia/src/ports/SkFontHost_FreeType.cpp",
484     ]
485   }
487   # Select the right BitmapPlatformDevice.
488   if (is_win) {
489     sources += [
490       "ext/bitmap_platform_device_win.cc",
491       "ext/bitmap_platform_device_win.h",
492     ]
493   } else if (is_mac) {
494     sources += [
495       "ext/bitmap_platform_device_mac.cc",
496       "ext/bitmap_platform_device_mac.h",
497     ]
498   } else if (use_cairo) {
499     sources += [
500       "ext/bitmap_platform_device_cairo.cc",
501       "ext/bitmap_platform_device_cairo.h",
502     ]
503   } else {
504     sources += [
505       "ext/bitmap_platform_device_skia.cc",
506       "ext/bitmap_platform_device_skia.h",
507     ]
508   }
510   if (is_clang) {
511     # Skia won't compile with some of the more strict clang warnings.
512     # e.g. it does:
513     #  SkASSERT(!"sk_out_of_memory");
514     configs -= [ "//build/config/clang:extra_warnings" ]
515   }
517   configs -= [ "//build/config/compiler:chromium_code" ]
518   configs += [
519     ":skia_library_config",
520     "//build/config/compiler:no_chromium_code",
521   ]
522   public_configs = [ ":skia_config" ]
524   deps = [
525     ":skia_opts",
526     "//base",
527     "//base/third_party/dynamic_annotations",
528     "//third_party/zlib",
529   ]
531   if (is_win) {
532     configs -= [
533       # Some files define WIN32_LEAN_AND_MEAN and we want to avoid a duplicate
534       # definition warning.
535       "//build/config/win:lean_and_mean",
536     ]
537   }
539   if (is_linux) {
540     configs += [
541       "//build/config/linux:fontconfig",
542       "//build/config/linux:freetype2",
543     ]
544     if (use_pango) {
545       configs += [ "//build/config/linux:pangocairo" ]
546     }
547     deps += [ "//third_party/icu:icuuc" ]
548   }
550   if (is_android) {
551     set_sources_assignment_filter([])
552     sources += [ "ext/platform_device_linux.cc" ]
553     set_sources_assignment_filter(sources_assignment_filter)
554     deps += [
555       "//third_party/expat",
556       "//third_party/freetype",
557       "//third_party/android_tools:cpu_features",
558     ]
559   }
561   if (skia_support_pdf) {
562     deps += [ "//third_party/sfntly" ]
563     sources += gypi_skia_pdf.sources
564   }
566   if (is_android && !is_debug) {
567     configs -= [ "//build/config/compiler:optimize" ]
568     configs += [ "//build/config/compiler:optimize_max" ]
569   }
572 # Separated out so it can be compiled with different flags for SSE.
573 source_set("skia_opts") {
574   cflags = []
575   defines = []
577   if (cpu_arch == "x86" || cpu_arch == "x64") {
578     sources = gypi_skia_opts.sse2_sources + gypi_skia_opts.ssse3_sources +
579               gypi_skia_opts.sse41_sources +
580               [
581                 # Chrome-specific.
582                 "ext/convolver_SSE2.cc",
583               ]
585     if (is_linux || is_mac) {
586       cflags += [ "-msse4.1" ]
587     }
588   } else if (cpu_arch == "arm") {
589     # The assembly uses the frame pointer register (r7 in Thumb/r11 in
590     # ARM), the compiler doesn't like that.
591     cflags += [ "-fomit-frame-pointer" ]
593     if (arm_version >= 7) {
594       sources = gypi_skia_opts.armv7_sources
595       if (arm_use_neon || arm_optionally_use_neon) {
596         sources += gypi_skia_opts.neon_sources
598         # Root build config sets -mfpu=$arm_fpu, which we expect to be neon
599         # when running this.
600         if (!arm_use_neon) {
601           configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
602           cflags += [ "-mfpu=neon" ]
603         }
604       }
605     } else {
606       sources = gypi_skia_opts.none_sourcees
607     }
608   } else if (cpu_arch == "mipsel") {
609     cflags += [ "-fomit-frame-pointer" ]
610     sources = gypi_skia_opts.none_sources
611   } else {
612     assert(false, "Need to port cpu specific stuff from skia_library_opts.gyp")
613   }
615   if (is_android && !is_debug) {
616     configs -= [ "//build/config/compiler:optimize" ]
617     configs += [ "//build/config/compiler:optimize_max" ]
618   }
620   configs -= [ "//build/config/compiler:chromium_code" ]
621   configs += [
622     ":skia_config",
623     ":skia_library_config",
624     "//build/config/compiler:no_chromium_code",
625   ]
627   deps = [
628     "//base",
629   ]
631   visibility = [ ":skia" ]
634 test("skia_unittests") {
635   sources = [
636     "ext/analysis_canvas_unittest.cc",
637     "ext/bitmap_platform_device_mac_unittest.cc",
638     "ext/convolver_unittest.cc",
639     "ext/image_operations_unittest.cc",
640     "ext/pixel_ref_utils_unittest.cc",
641     "ext/platform_canvas_unittest.cc",
642     "ext/recursive_gaussian_convolution_unittest.cc",
643     "ext/refptr_unittest.cc",
644     "ext/skia_utils_ios_unittest.mm",
645     "ext/skia_utils_mac_unittest.mm",
646   ]
648   if (!is_win && !is_mac) {
649     sources -= [ "ext/platform_canvas_unittest.cc" ]
650   }
652   deps = [
653     ":skia",
654     "//base",
655     "//base/test:run_all_unittests",
656     "//testing/gtest",
657     "//ui/gfx",
658     "//ui/gfx/geometry",
659   ]