diff options
author | bungeman <bungeman@google.com> | 2015-07-29 11:49:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-29 11:49:40 -0700 |
commit | f20488b4f2139e6ca09fee7e39b731dd8ab467db (patch) | |
tree | 9937f93de673f5b6ab43c8ced877fa828e27f3dc | |
parent | 26e0e587f76f2a9338652c100f835c2377c908d3 (diff) | |
download | platform_external_skqp-f20488b4f2139e6ca09fee7e39b731dd8ab467db.tar.gz platform_external_skqp-f20488b4f2139e6ca09fee7e39b731dd8ab467db.tar.bz2 platform_external_skqp-f20488b4f2139e6ca09fee7e39b731dd8ab467db.zip |
Clean up a few includes, introduce iwyu.
The current include-what-you-use with current clang is much less
noisy and more useful than it has been in the past. This change
introduces a few IWYU directives (which are helpful documentation for
humans as well) and fixes a few sets of includes.
Review URL: https://codereview.chromium.org/1207893002
-rw-r--r-- | include/core/SkAtomics.h | 2 | ||||
-rw-r--r-- | include/core/SkMutex.h | 2 | ||||
-rw-r--r-- | include/core/SkPostConfig.h | 9 | ||||
-rw-r--r-- | include/core/SkTypes.h | 6 | ||||
-rw-r--r-- | include/ports/SkFontMgr_indirect.h | 7 | ||||
-rw-r--r-- | include/ports/SkRemotableFontMgr.h | 6 | ||||
-rw-r--r-- | src/fonts/SkFontMgr_indirect.cpp | 13 | ||||
-rw-r--r-- | src/ports/SkDebug_stdio.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkDiscardableMemory_none.cpp | 1 | ||||
-rw-r--r-- | src/ports/SkFontConfigInterface_direct.cpp | 16 | ||||
-rw-r--r-- | src/ports/SkFontHost_fontconfig.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkFontMgr_android.cpp | 21 | ||||
-rw-r--r-- | src/ports/SkFontMgr_android_parser.cpp | 5 | ||||
-rw-r--r-- | src/ports/SkFontMgr_android_parser.h | 3 | ||||
-rw-r--r-- | src/ports/SkFontMgr_custom.cpp | 17 | ||||
-rw-r--r-- | src/ports/SkFontMgr_fontconfig.cpp | 12 | ||||
-rw-r--r-- | src/ports/SkFontMgr_fontconfig_factory.cpp | 1 | ||||
-rw-r--r-- | src/ports/SkGlobalInitialization_default.cpp | 4 | ||||
-rw-r--r-- | src/ports/SkMemory_malloc.cpp | 4 | ||||
-rw-r--r-- | src/ports/SkOSFile_posix.cpp | 4 | ||||
-rw-r--r-- | src/ports/SkOSFile_stdio.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkTime_Unix.cpp | 2 |
22 files changed, 81 insertions, 60 deletions
diff --git a/include/core/SkAtomics.h b/include/core/SkAtomics.h index be94164227..d31d9c64fb 100644 --- a/include/core/SkAtomics.h +++ b/include/core/SkAtomics.h @@ -67,6 +67,7 @@ private: T fVal; }; +// IWYU pragma: begin_exports #if defined(_MSC_VER) #include "../ports/SkAtomics_std.h" #elif !defined(SK_BUILD_FOR_IOS) && defined(__ATOMIC_RELAXED) @@ -74,6 +75,7 @@ private: #else #include "../ports/SkAtomics_sync.h" #endif +// IWYU pragma: end_exports // From here down we have shims for our old atomics API, to be weaned off of. // We use the default sequentially-consistent memory order to make things simple diff --git a/include/core/SkMutex.h b/include/core/SkMutex.h index 08b220c396..eb5e29b80a 100644 --- a/include/core/SkMutex.h +++ b/include/core/SkMutex.h @@ -11,11 +11,13 @@ // This file is not part of the public Skia API. #include "SkTypes.h" +// IWYU pragma: begin_exports #if defined(SK_BUILD_FOR_WIN) #include "../ports/SkMutex_win.h" #else #include "../ports/SkMutex_pthread.h" #endif +// IWYU pragma: end_exports template <typename Lock> class SkAutoTAcquire : SkNoncopyable { diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h index 2074230ba6..6f3e2d1fc7 100644 --- a/include/core/SkPostConfig.h +++ b/include/core/SkPostConfig.h @@ -8,7 +8,7 @@ #ifndef SkPostConfig_DEFINED #define SkPostConfig_DEFINED -#if defined(SK_BUILD_FOR_WIN32) || defined(SK_BUILD_FOR_WINCE) +#if defined(SK_BUILD_FOR_WIN32) # define SK_BUILD_FOR_WIN #endif @@ -215,13 +215,6 @@ #endif ////////////////////////////////////////////////////////////////////////////////////////////// -#ifndef SK_BUILD_FOR_WINCE -# include <string.h> -# include <stdlib.h> -#else -# define _CMNINTRIN_DECLARE_ONLY -# include "cmnintrin.h" -#endif #if defined SK_DEBUG && defined SK_BUILD_FOR_WIN32 # ifdef free diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index 1b0b12c621..1a165a148a 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -8,9 +8,11 @@ #ifndef SkTypes_DEFINED #define SkTypes_DEFINED +// IWYU pragma: begin_exports #include "SkPreConfig.h" #include "SkUserConfig.h" #include "SkPostConfig.h" +#include <stddef.h> #include <stdint.h> #include <sys/types.h> @@ -19,6 +21,10 @@ #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 #include <immintrin.h> #endif +// IWYU pragma: end_exports + +#include <stdlib.h> +#include <string.h> /** \file SkTypes.h */ diff --git a/include/ports/SkFontMgr_indirect.h b/include/ports/SkFontMgr_indirect.h index 96ba3632d5..2e28640a16 100644 --- a/include/ports/SkFontMgr_indirect.h +++ b/include/ports/SkFontMgr_indirect.h @@ -10,16 +10,17 @@ #include "SkDataTable.h" #include "SkFontMgr.h" -#include "SkFontStyle.h" #include "SkMutex.h" +#include "SkRefCnt.h" #include "SkRemotableFontMgr.h" #include "SkTArray.h" #include "SkTypeface.h" +#include "SkTypes.h" class SkData; -class SkStream; +class SkFontStyle; +class SkStreamAsset; class SkString; -class SkTypeface; class SK_API SkFontMgr_Indirect : public SkFontMgr { public: diff --git a/include/ports/SkRemotableFontMgr.h b/include/ports/SkRemotableFontMgr.h index 63c032c821..23abd7f5de 100644 --- a/include/ports/SkRemotableFontMgr.h +++ b/include/ports/SkRemotableFontMgr.h @@ -11,10 +11,10 @@ #include "SkFontStyle.h" #include "SkRefCnt.h" #include "SkTemplates.h" +#include "SkTypes.h" class SkDataTable; class SkStreamAsset; -class SkString; struct SK_API SkFontIdentity { static const uint32_t kInvalidDataId = 0xFFFFFFFF; @@ -35,8 +35,6 @@ struct SK_API SkFontIdentity { class SK_API SkRemotableFontIdentitySet : public SkRefCnt { public: - - SkRemotableFontIdentitySet(int count, SkFontIdentity** data); int count() const { return fCount; } @@ -57,8 +55,6 @@ private: class SK_API SkRemotableFontMgr : public SkRefCnt { public: - - /** * Returns the names of the known fonts on the system. * Will not return NULL, will return an empty table if no families exist. diff --git a/src/fonts/SkFontMgr_indirect.cpp b/src/fonts/SkFontMgr_indirect.cpp index 172d5412a6..6ad8bfbf47 100644 --- a/src/fonts/SkFontMgr_indirect.cpp +++ b/src/fonts/SkFontMgr_indirect.cpp @@ -5,17 +5,22 @@ * found in the LICENSE file. */ -#include "SkFontMgr_indirect.h" - #include "SkDataTable.h" +#include "SkFontMgr.h" +#include "SkFontMgr_indirect.h" #include "SkFontStyle.h" +#include "SkMutex.h" #include "SkOnce.h" +#include "SkRefCnt.h" +#include "SkRemotableFontMgr.h" #include "SkStream.h" -#include "SkTSearch.h" +#include "SkString.h" +#include "SkTArray.h" #include "SkTypeface.h" +#include "SkTypes.h" +#include "SkTemplates.h" class SkData; -class SkString; class SkStyleSet_Indirect : public SkFontStyleSet { public: diff --git a/src/ports/SkDebug_stdio.cpp b/src/ports/SkDebug_stdio.cpp index 8ff27ade3c..9e72d4797e 100644 --- a/src/ports/SkDebug_stdio.cpp +++ b/src/ports/SkDebug_stdio.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2006 The Android Open Source Project * @@ -6,7 +5,6 @@ * found in the LICENSE file. */ - #include "SkTypes.h" #include <stdarg.h> diff --git a/src/ports/SkDiscardableMemory_none.cpp b/src/ports/SkDiscardableMemory_none.cpp index 51c3164dfa..7e5c0aeade 100644 --- a/src/ports/SkDiscardableMemory_none.cpp +++ b/src/ports/SkDiscardableMemory_none.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ +#include "SkDiscardableMemory.h" #include "SkDiscardableMemoryPool.h" #include "SkTypes.h" diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp index 8589cc2421..9ef088d8b7 100644 --- a/src/ports/SkFontConfigInterface_direct.cpp +++ b/src/ports/SkFontConfigInterface_direct.cpp @@ -7,17 +7,21 @@ /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ -#include <unistd.h> -#include <fcntl.h> - -#include <fontconfig/fontconfig.h> - #include "SkBuffer.h" +#include "SkDataTable.h" #include "SkFontConfigInterface.h" -#include "SkLazyPtr.h" +#include "SkFontStyle.h" #include "SkMutex.h" #include "SkStream.h" #include "SkString.h" +#include "SkTArray.h" +#include "SkTDArray.h" +#include "SkTemplates.h" +#include "SkTypeface.h" +#include "SkTypes.h" + +#include <fontconfig/fontconfig.h> +#include <unistd.h> size_t SkFontConfigInterface::FontIdentity::writeToMemory(void* addr) const { size_t size = sizeof(fID) + sizeof(fTTCIndex); diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp index 2fdb16e364..540d805c38 100644 --- a/src/ports/SkFontHost_fontconfig.cpp +++ b/src/ports/SkFontHost_fontconfig.cpp @@ -8,8 +8,6 @@ #include "SkFontConfigInterface.h" #include "SkFontConfigTypeface.h" #include "SkFontDescriptor.h" -#include "SkFontHost_FreeType_common.h" -#include "SkFontStream.h" #include "SkStream.h" #include "SkTypeface.h" #include "SkTypefaceCache.h" diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp index f85539ca53..88045a4b20 100644 --- a/src/ports/SkFontMgr_android.cpp +++ b/src/ports/SkFontMgr_android.cpp @@ -5,20 +5,27 @@ * found in the LICENSE file. */ +#include "SkFixed.h" #include "SkFontDescriptor.h" #include "SkFontHost_FreeType_common.h" #include "SkFontMgr.h" #include "SkFontMgr_android.h" #include "SkFontMgr_android_parser.h" #include "SkFontStyle.h" +#include "SkRefCnt.h" +#include "SkString.h" #include "SkStream.h" +#include "SkTArray.h" #include "SkTDArray.h" #include "SkTSearch.h" +#include "SkTemplates.h" #include "SkTypeface.h" #include "SkTypefaceCache.h" #include <limits> +class SkData; + class SkTypeface_Android : public SkTypeface_FreeType { public: SkTypeface_Android(const SkFontStyle& style, @@ -275,9 +282,9 @@ private: } static int match_score(const SkFontStyle& pattern, const SkFontStyle& candidate) { int score = 0; - score += abs((pattern.width() - candidate.width()) * 100); - score += abs((pattern.isItalic() == candidate.isItalic()) ? 0 : 1000); - score += abs(pattern.weight() - candidate.weight()); + score += SkTAbs((pattern.width() - candidate.width()) * 100); + score += SkTAbs((pattern.isItalic() == candidate.isItalic()) ? 0 : 1000); + score += SkTAbs(pattern.weight() - candidate.weight()); return score; } @@ -400,13 +407,7 @@ protected: continue; } - SkPaint paint; - paint.setTypeface(face); - paint.setTextEncoding(SkPaint::kUTF32_TextEncoding); - - uint16_t glyphID; - paint.textToGlyphs(&character, sizeof(character), &glyphID); - if (glyphID != 0) { + if (face->charsToGlyphs(&character, SkTypeface::kUTF32_Encoding, NULL, 0)) { return face.detach(); } } diff --git a/src/ports/SkFontMgr_android_parser.cpp b/src/ports/SkFontMgr_android_parser.cpp index 5ca6d4fcc5..53decf36cf 100644 --- a/src/ports/SkFontMgr_android_parser.cpp +++ b/src/ports/SkFontMgr_android_parser.cpp @@ -9,12 +9,13 @@ #include "SkStream.h" #include "SkTDArray.h" #include "SkTSearch.h" -#include "SkTypeface.h" +#include "SkTemplates.h" -#include <expat.h> #include <dirent.h> +#include <expat.h> #include <stdlib.h> +#include <string.h> #define LMP_SYSTEM_FONTS_FILE "/system/etc/fonts.xml" #define OLD_SYSTEM_FONTS_FILE "/system/etc/system_fonts.xml" diff --git a/src/ports/SkFontMgr_android_parser.h b/src/ports/SkFontMgr_android_parser.h index d2a430513f..175a6fa1fe 100644 --- a/src/ports/SkFontMgr_android_parser.h +++ b/src/ports/SkFontMgr_android_parser.h @@ -8,8 +8,11 @@ #ifndef SkFontMgr_android_parser_DEFINED #define SkFontMgr_android_parser_DEFINED +#include "SkFixed.h" #include "SkString.h" +#include "SkTArray.h" #include "SkTDArray.h" +#include "SkTypes.h" #include <climits> #include <limits> diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp index cea0b4875e..835acd786f 100644 --- a/src/ports/SkFontMgr_custom.cpp +++ b/src/ports/SkFontMgr_custom.cpp @@ -5,22 +5,25 @@ * found in the LICENSE file. */ -#include "SkFontHost_FreeType_common.h" #include "SkFontDescriptor.h" +#include "SkFontHost_FreeType_common.h" #include "SkFontMgr.h" #include "SkFontMgr_custom.h" -#include "SkDescriptor.h" +#include "SkFontStyle.h" #include "SkOSFile.h" -#include "SkPaint.h" -#include "SkRTConf.h" -#include "SkString.h" +#include "SkRefCnt.h" #include "SkStream.h" -#include "SkTSearch.h" -#include "SkTypefaceCache.h" +#include "SkString.h" #include "SkTArray.h" +#include "SkTemplates.h" +#include "SkTypeface.h" +#include "SkTypefaceCache.h" +#include "SkTypes.h" #include <limits> +class SkData; + /** The base SkTypeface implementation for the custom font manager. */ class SkTypeface_Custom : public SkTypeface_FreeType { public: diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp index 7000e31db4..e98bd01995 100644 --- a/src/ports/SkFontMgr_fontconfig.cpp +++ b/src/ports/SkFontMgr_fontconfig.cpp @@ -6,19 +6,27 @@ */ #include "SkDataTable.h" +#include "SkFixed.h" #include "SkFontDescriptor.h" #include "SkFontHost_FreeType_common.h" #include "SkFontMgr.h" #include "SkFontStyle.h" #include "SkMath.h" #include "SkMutex.h" -#include "SkString.h" +#include "SkOSFile.h" +#include "SkRefCnt.h" #include "SkStream.h" +#include "SkString.h" #include "SkTDArray.h" +#include "SkTemplates.h" +#include "SkTypeface.h" #include "SkTypefaceCache.h" -#include "SkOSFile.h" +#include "SkTypes.h" #include <fontconfig/fontconfig.h> +#include <string.h> + +class SkData; // FC_POSTSCRIPT_NAME was added with b561ff20 which ended up in 2.10.92 // Ubuntu 12.04 is on 2.8.0, 13.10 is on 2.10.93 diff --git a/src/ports/SkFontMgr_fontconfig_factory.cpp b/src/ports/SkFontMgr_fontconfig_factory.cpp index b959acbbe2..78792fa989 100644 --- a/src/ports/SkFontMgr_fontconfig_factory.cpp +++ b/src/ports/SkFontMgr_fontconfig_factory.cpp @@ -7,6 +7,7 @@ #include "SkFontMgr.h" #include "SkFontMgr_fontconfig.h" +#include "SkTypes.h" SkFontMgr* SkFontMgr::Factory() { return SkFontMgr_New_FontConfig(NULL); diff --git a/src/ports/SkGlobalInitialization_default.cpp b/src/ports/SkGlobalInitialization_default.cpp index 0f7d71b207..fb496f65cb 100644 --- a/src/ports/SkGlobalInitialization_default.cpp +++ b/src/ports/SkGlobalInitialization_default.cpp @@ -5,12 +5,8 @@ * found in the LICENSE file. */ -#include "SkTypes.h" - #include "SkBitmapProcShader.h" -#include "SkMallocPixelRef.h" #include "SkPathEffect.h" -#include "SkPixelRef.h" #include "SkXfermode.h" #include "Sk1DPathEffect.h" diff --git a/src/ports/SkMemory_malloc.cpp b/src/ports/SkMemory_malloc.cpp index 0b936c9f8c..f9836c0e0e 100644 --- a/src/ports/SkMemory_malloc.cpp +++ b/src/ports/SkMemory_malloc.cpp @@ -1,12 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "SkTypes.h" -#include <stdio.h> + #include <stdlib.h> #define SK_DEBUGFAILF(fmt, ...) \ diff --git a/src/ports/SkOSFile_posix.cpp b/src/ports/SkOSFile_posix.cpp index cea688b86f..6f64478d04 100644 --- a/src/ports/SkOSFile_posix.cpp +++ b/src/ports/SkOSFile_posix.cpp @@ -6,12 +6,14 @@ */ #include "SkOSFile.h" - +#include "SkString.h" #include "SkTFitsIn.h" +#include "SkTemplates.h" #include "SkTypes.h" #include <dirent.h> #include <stdio.h> +#include <string.h> #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> diff --git a/src/ports/SkOSFile_stdio.cpp b/src/ports/SkOSFile_stdio.cpp index d63462549c..a7d776afb1 100644 --- a/src/ports/SkOSFile_stdio.cpp +++ b/src/ports/SkOSFile_stdio.cpp @@ -6,11 +6,11 @@ */ #include "SkOSFile.h" +#include "SkTypes.h" #include <errno.h> #include <stdio.h> #include <sys/stat.h> -#include <sys/types.h> #ifdef _WIN32 #include <direct.h> diff --git a/src/ports/SkTime_Unix.cpp b/src/ports/SkTime_Unix.cpp index 2d5fa279b4..84f1a4e374 100644 --- a/src/ports/SkTime_Unix.cpp +++ b/src/ports/SkTime_Unix.cpp @@ -6,8 +6,8 @@ * found in the LICENSE file. */ - #include "SkTime.h" +#include "SkTypes.h" #include <sys/time.h> #include <time.h> |