From 02802f64ea0b1fc9223386328a95280b74092c94 Mon Sep 17 00:00:00 2001 From: jvanverth Date: Thu, 2 Jul 2015 06:42:49 -0700 Subject: Revert of Remove SkThread.h, include SkMutex.h or SkAtomics.h as appropriate. (patchset #4 id:60001 of https://codereview.chromium.org/1215393002/) Reason for revert: Breaking the roll. E.g. on android_chromium_gn_compile_dbg: FAILED: /b/build/goma/gomacc ../../third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -MMD -MF obj/skia/ext/libskia.SkMemory_new_handler.o.d -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=1 -DENABLE_NOTIFICATIONS -DENABLE_BROWSER_CDMS -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DDONT_EMBED_BUILD_METADATA -DUSE_OPENSSL=1 -DUSE_OPENSSL_CERTS=1 -DNO_TCMALLOC -DDISABLE_NACL -DENABLE_CONFIGURATION_POLICY -DENABLE_SUPERVISED_USERS=1 -DENABLE_AUTOFILL_DIALOG=1 -DUSE_PROPRIETARY_CODECS -DV8_USE_EXTERNAL_STARTUP_DATA -DVIDEO_HOLE=1 -DMOBILE_SAFE_BROWSING -DSAFE_BROWSING_SERVICE -DCHROMIUM_BUILD -D_FILE_OFFSET_BITS=64 -DANDROID -DHAVE_SYS_UIO_H -DCOMPONENT_BUILD -D__GNU_SOURCE=1 -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -DSKIA_IMPLEMENTATION=1 -DSK_ARM_HAS_OPTIONAL_NEON -DSK_GAMMA_APPLY_TO_A8 -DSK_GAMMA_EXPONENT=1.4 -DSK_GAMMA_CONTRAST=0.0 -DSK_DEFAULT_FONT_CACHE_LIMIT=1048576 -DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS -DSKIA_DLL -DGR_GL_IGNORE_ES3_MSAA=0 -DSK_SUPPORT_GPU=1 -DSK_BUILD_FOR_ANDROID -DUSE_CHROMIUM_SKIA -DXML_STATIC -I../.. -Igen -I../../third_party/skia/include/private -I../../third_party/skia/src/core -I../../third_party/skia/src/image -I../../third_party/skia/src/opts -I../../third_party/skia/src/pdf -I../../third_party/skia/src/ports -I../../third_party/skia/src/sfnt -I../../third_party/skia/src/utils -I../../third_party/skia/src/lazy -I../../skia/config -I../../skia/ext -I../../third_party/skia/include/c -I../../third_party/skia/include/config -I../../third_party/skia/include/core -I../../third_party/skia/include/effects -I../../third_party/skia/include/images -I../../third_party/skia/include/lazy -I../../third_party/skia/include/pathops -I../../third_party/skia/include/pdf -I../../third_party/skia/include/pipe -I../../third_party/skia/include/ports -I../../third_party/skia/include/utils -I../../third_party/skia/include/gpu -I../../third_party/skia/src/gpu -I../../third_party/zlib -I../../third_party/expat/files/lib -I../../third_party/freetype-android/include -I../../third_party/freetype-android/src/include -I../../third_party/android_tools/ndk/sources/android/cpufeatures -fno-strict-aliasing -march=armv7-a -mfloat-abi=softfp -mtune=generic-armv7-a -mthumb -mthumb-interwork -fno-tree-sra -fno-caller-saves -funwind-tables -fPIC -pipe -ffunction-sections -funwind-tables -fno-short-enums -finline-limit=64 -mfpu=vfpv3-d16 -isystem../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include -isystem../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++abi/libcxxabi/include -isystem../../third_party/android_tools/ndk/sources/android/support/include -fvisibility=hidden --sysroot=/b/build/slave/android_chromium_gn/build/src/third_party/android_tools/ndk/platforms/android-16/arch-arm -Os -fdata-sections -ffunction-sections -fomit-frame-pointer -g1 -Wno-format -Wendif-labels -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wno-extra -Wno-ignored-qualifiers -Wno-type-limits -Wno-unused-local-typedefs -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -fno-rtti -fno-exceptions -Wno-deprecated -Wno-narrowing -Wno-literal-suffix -Wno-error=c++0x-compat -Wno-non-virtual-dtor -Wno-sign-promo -c ../../skia/ext/SkMemory_new_handler.cpp -o obj/skia/ext/libskia.SkMemory_new_handler.o ../../skia/ext/SkMemory_new_handler.cpp:12:52: fatal error: third_party/skia/include/core/SkThread.h: No such file or directory #include "third_party/skia/include/core/SkThread.h" Original issue's description: > Remove SkThread.h, include SkMutex.h or SkAtomics.h as appropriate. > > SkThread.h doesn't do anything anymore execept include those two, > and thankfully, it doesn't seem to be mentioned outside Skia. > > No public API changes. > TBR=reed@google.com > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/c50acf2321d7a934c80d754e9cbe936dfb8eb4cc TBR=mtklein@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1214603003 --- bench/MutexBench.cpp | 2 +- bench/RefCntBench.cpp | 2 +- dm/DM.cpp | 1 - dm/DMJsonWriter.cpp | 2 +- gyp/core.gypi | 1 + include/core/SkThread.h | 16 ++++++++++++++++ include/core/SkWeakRefCnt.h | 2 +- include/ports/SkFontMgr_indirect.h | 1 - src/core/SkAAClip.cpp | 2 +- src/core/SkBitmap.cpp | 8 ++++---- src/core/SkBitmapHeap.h | 6 +++--- src/core/SkCachedData.h | 4 ++-- src/core/SkClipStack.cpp | 2 +- src/core/SkDeviceProfile.cpp | 2 +- src/core/SkDrawable.cpp | 2 +- src/core/SkGlyphCache.cpp | 5 +++-- src/core/SkGlyphCache_Globals.h | 1 - src/core/SkImageFilter.cpp | 9 ++++----- src/core/SkMessageBus.h | 2 +- src/core/SkPaint.cpp | 1 - src/core/SkPath.cpp | 3 ++- src/core/SkPixelRef.cpp | 2 +- src/core/SkRegion.cpp | 2 +- src/core/SkRegionPriv.h | 2 +- src/core/SkResourceCache.cpp | 11 ++++++----- src/core/SkScalerContext.cpp | 1 + src/core/SkShader.cpp | 4 ++-- src/core/SkString.cpp | 4 ++-- src/core/SkTLS.cpp | 9 +-------- src/core/SkTypeface.cpp | 1 - src/core/SkTypefaceCache.cpp | 3 +-- src/fonts/SkFontMgr_fontconfig.cpp | 6 +++--- src/fonts/SkTestScalerContext.cpp | 2 +- src/gpu/GrBatch.h | 4 ++-- src/gpu/gl/GrGLNoOpInterface.cpp | 2 +- src/lazy/SkDiscardableMemoryPool.cpp | 2 +- src/pathops/SkPathOpsDebug.cpp | 6 +++--- src/ports/SkFontConfigInterface_direct.cpp | 1 - src/ports/SkFontHost_FreeType.cpp | 2 +- src/ports/SkFontHost_FreeType_common.h | 1 - src/ports/SkFontHost_mac.cpp | 12 ++++++------ src/ports/SkFontHost_win.cpp | 1 + src/ports/SkFontMgr_custom.cpp | 1 + src/ports/SkFontMgr_fontconfig.cpp | 2 +- src/ports/SkFontMgr_win_dw.cpp | 2 +- src/ports/SkRemotableFontMgr_win_dw.cpp | 6 +++--- src/ports/SkTLS_win.cpp | 2 +- src/views/SkEvent.cpp | 2 +- src/views/SkEventSink.cpp | 6 ++++-- src/views/SkOSMenu.cpp | 4 ++-- tests/AtomicTest.cpp | 2 +- tests/PathOpsExtendedTest.cpp | 2 +- tests/PathOpsExtendedTest.h | 2 ++ tests/skia_test.cpp | 2 +- tools/sk_tool_utils_font.cpp | 2 +- tools/skpdiff/SkDiffContext.h | 12 ++++++------ 56 files changed, 105 insertions(+), 94 deletions(-) create mode 100644 include/core/SkThread.h diff --git a/bench/MutexBench.cpp b/bench/MutexBench.cpp index 8d7eb98546..7fd8fabba1 100644 --- a/bench/MutexBench.cpp +++ b/bench/MutexBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ #include "Benchmark.h" -#include "SkMutex.h" +#include "SkThread.h" class MutexBench : public Benchmark { public: diff --git a/bench/RefCntBench.cpp b/bench/RefCntBench.cpp index ee5d74622e..78b02edb60 100644 --- a/bench/RefCntBench.cpp +++ b/bench/RefCntBench.cpp @@ -6,8 +6,8 @@ */ #include #include "Benchmark.h" -#include "SkAtomics.h" #include "SkRefCnt.h" +#include "SkThread.h" #include "SkWeakRefCnt.h" enum { diff --git a/dm/DM.cpp b/dm/DM.cpp index 6b3464157b..c3a4272509 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -18,7 +18,6 @@ #include "SkForceLinking.h" #include "SkGraphics.h" #include "SkMD5.h" -#include "SkMutex.h" #include "SkOSFile.h" #include "SkTHash.h" #include "SkTaskGroup.h" diff --git a/dm/DMJsonWriter.cpp b/dm/DMJsonWriter.cpp index 5317567d68..04ae2cea8a 100644 --- a/dm/DMJsonWriter.cpp +++ b/dm/DMJsonWriter.cpp @@ -11,10 +11,10 @@ #include "SkCommonFlags.h" #include "SkData.h" #include "SkJSONCPP.h" -#include "SkMutex.h" #include "SkOSFile.h" #include "SkStream.h" #include "SkTArray.h" +#include "SkThread.h" namespace DM { diff --git a/gyp/core.gypi b/gyp/core.gypi index 10149d878a..edc77e17c6 100644 --- a/gyp/core.gypi +++ b/gyp/core.gypi @@ -323,6 +323,7 @@ '<(skia_include_path)/core/SkTSearch.h', '<(skia_include_path)/core/SkTemplates.h', '<(skia_include_path)/core/SkTextBlob.h', + '<(skia_include_path)/core/SkThread.h', '<(skia_include_path)/core/SkTime.h', '<(skia_include_path)/core/SkTLazy.h', '<(skia_include_path)/core/SkTypeface.h', diff --git a/include/core/SkThread.h b/include/core/SkThread.h new file mode 100644 index 0000000000..67e0b72d1c --- /dev/null +++ b/include/core/SkThread.h @@ -0,0 +1,16 @@ +/* + * Copyright 2006 The Android Open Source Project + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkThread_DEFINED +#define SkThread_DEFINED + +// TODO: delete this file, or maybe move the definition of SkThread here. + +#include "SkAtomics.h" +#include "SkMutex.h" + +#endif diff --git a/include/core/SkWeakRefCnt.h b/include/core/SkWeakRefCnt.h index a550951970..0798f4e509 100644 --- a/include/core/SkWeakRefCnt.h +++ b/include/core/SkWeakRefCnt.h @@ -9,7 +9,7 @@ #define SkWeakRefCnt_DEFINED #include "SkRefCnt.h" -#include "SkAtomics.h" +#include "SkThread.h" /** \class SkWeakRefCnt diff --git a/include/ports/SkFontMgr_indirect.h b/include/ports/SkFontMgr_indirect.h index 96ba3632d5..0977eea26a 100644 --- a/include/ports/SkFontMgr_indirect.h +++ b/include/ports/SkFontMgr_indirect.h @@ -11,7 +11,6 @@ #include "SkDataTable.h" #include "SkFontMgr.h" #include "SkFontStyle.h" -#include "SkMutex.h" #include "SkRemotableFontMgr.h" #include "SkTArray.h" #include "SkTypeface.h" diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp index 902b87a6c7..19e94c8c86 100644 --- a/src/core/SkAAClip.cpp +++ b/src/core/SkAAClip.cpp @@ -7,11 +7,11 @@ */ #include "SkAAClip.h" -#include "SkAtomics.h" #include "SkBlitter.h" #include "SkColorPriv.h" #include "SkPath.h" #include "SkScan.h" +#include "SkThread.h" #include "SkUtils.h" class AutoAAClipValidate { diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index aa26bdcab3..8f799125e4 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -7,7 +7,6 @@ */ -#include "SkAtomics.h" #include "SkBitmap.h" #include "SkColorPriv.h" #include "SkDither.h" @@ -15,13 +14,14 @@ #include "SkImagePriv.h" #include "SkMallocPixelRef.h" #include "SkMask.h" -#include "SkPackBits.h" -#include "SkPixelRef.h" #include "SkReadBuffer.h" +#include "SkWriteBuffer.h" +#include "SkPixelRef.h" +#include "SkThread.h" #include "SkUnPreMultiply.h" #include "SkUtils.h" #include "SkValidationUtils.h" -#include "SkWriteBuffer.h" +#include "SkPackBits.h" #include static bool reset_return_false(SkBitmap* bm) { diff --git a/src/core/SkBitmapHeap.h b/src/core/SkBitmapHeap.h index 259d947923..07f629c77a 100644 --- a/src/core/SkBitmapHeap.h +++ b/src/core/SkBitmapHeap.h @@ -12,7 +12,7 @@ #include "SkFlattenable.h" #include "SkRefCnt.h" #include "SkTDArray.h" -#include "SkAtomics.h" +#include "SkThread.h" /** * SkBitmapHeapEntry provides users of SkBitmapHeap (using internal storage) with a means to... @@ -52,7 +52,7 @@ private: class SkBitmapHeapReader : public SkRefCnt { public: - + SkBitmapHeapReader() : INHERITED() {} virtual SkBitmap* getBitmap(int32_t slot) const = 0; @@ -69,7 +69,7 @@ class SkBitmapHeap : public SkBitmapHeapReader { public: class ExternalStorage : public SkRefCnt { public: - + virtual bool insert(const SkBitmap& bitmap, int32_t slot) = 0; diff --git a/src/core/SkCachedData.h b/src/core/SkCachedData.h index 6493a75e0b..886ca3e7e4 100644 --- a/src/core/SkCachedData.h +++ b/src/core/SkCachedData.h @@ -8,7 +8,7 @@ #ifndef SkCachedData_DEFINED #define SkCachedData_DEFINED -#include "SkMutex.h" +#include "SkThread.h" class SkDiscardableMemory; @@ -78,7 +78,7 @@ public: #else void validate() const {} #endif - + /* * Attaching a data to to a SkResourceCache (only one at a time) enables the data to be * unlocked when the cache is the only owner, thus freeing it to be purged (assuming the diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp index c4c68ced08..e0c3db01ba 100644 --- a/src/core/SkClipStack.cpp +++ b/src/core/SkClipStack.cpp @@ -5,11 +5,11 @@ * found in the LICENSE file. */ -#include "SkAtomics.h" #include "SkCanvas.h" #include "SkClipStack.h" #include "SkPath.h" #include "SkPathOps.h" +#include "SkThread.h" #include diff --git a/src/core/SkDeviceProfile.cpp b/src/core/SkDeviceProfile.cpp index 188e12b4b0..8d60151f6f 100644 --- a/src/core/SkDeviceProfile.cpp +++ b/src/core/SkDeviceProfile.cpp @@ -7,7 +7,7 @@ #include "SkDeviceProfile.h" -#include "SkMutex.h" +#include "SkThread.h" #define DEFAULT_GAMMAEXP 2.2f #define DEFAULT_CONTRASTSCALE 0.5f diff --git a/src/core/SkDrawable.cpp b/src/core/SkDrawable.cpp index 73f5779b7d..64fefd2f1c 100644 --- a/src/core/SkDrawable.cpp +++ b/src/core/SkDrawable.cpp @@ -5,9 +5,9 @@ * found in the LICENSE file. */ -#include "SkAtomics.h" #include "SkCanvas.h" #include "SkDrawable.h" +#include "SkThread.h" static int32_t next_generation_id() { static int32_t gCanvasDrawableGenerationID; diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index 6ae17b1074..ec342275cc 100755 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -9,11 +9,10 @@ #include "SkGlyphCache_Globals.h" #include "SkGraphics.h" #include "SkLazyPtr.h" -#include "SkMutex.h" #include "SkPaint.h" #include "SkPath.h" -#include "SkTLS.h" #include "SkTemplates.h" +#include "SkTLS.h" #include "SkTypeface.h" //#define SPEW_PURGE_STATUS @@ -418,6 +417,8 @@ void SkGlyphCache::invokeAndRemoveAuxProcs() { /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// +#include "SkThread.h" + size_t SkGlyphCache_Globals::setCacheSizeLimit(size_t newLimit) { static const size_t minLimit = 256 * 1024; if (newLimit < minLimit) { diff --git a/src/core/SkGlyphCache_Globals.h b/src/core/SkGlyphCache_Globals.h index e8f950f611..4bd607c598 100644 --- a/src/core/SkGlyphCache_Globals.h +++ b/src/core/SkGlyphCache_Globals.h @@ -9,7 +9,6 @@ #define SkGlyphCache_Globals_DEFINED #include "SkGlyphCache.h" -#include "SkMutex.h" #include "SkTLS.h" #ifndef SK_DEFAULT_FONT_CACHE_COUNT_LIMIT diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index 394d8b20e7..7233ec6706 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -13,13 +13,12 @@ #include "SkDevice.h" #include "SkLazyPtr.h" #include "SkMatrixImageFilter.h" -#include "SkMutex.h" #include "SkReadBuffer.h" +#include "SkWriteBuffer.h" #include "SkRect.h" #include "SkTDynamicHash.h" #include "SkTInternalLList.h" #include "SkValidationUtils.h" -#include "SkWriteBuffer.h" #if SK_SUPPORT_GPU #include "GrContext.h" #include "GrDrawContext.h" @@ -29,9 +28,9 @@ #ifdef SK_BUILD_FOR_IOS enum { kDefaultCacheSize = 2 * 1024 * 1024 }; -#else +#else enum { kDefaultCacheSize = 128 * 1024 * 1024 }; -#endif +#endif static int32_t next_image_filter_unique_id() { static int32_t gImageFilterUniqueID; @@ -547,4 +546,4 @@ bool SkImageFilter::Proxy::filterImage(const SkImageFilter* filter, const SkBitm SkBitmap* result, SkIPoint* offset) { return fDevice->filterImage(filter, src, ctx, result, offset); } - + diff --git a/src/core/SkMessageBus.h b/src/core/SkMessageBus.h index 6f032a1fe2..b25ab80798 100644 --- a/src/core/SkMessageBus.h +++ b/src/core/SkMessageBus.h @@ -9,9 +9,9 @@ #define SkMessageBus_DEFINED #include "SkLazyPtr.h" -#include "SkMutex.h" #include "SkTArray.h" #include "SkTDArray.h" +#include "SkThread.h" #include "SkTypes.h" template diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index eae8ec70e5..f40aeff727 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -17,7 +17,6 @@ #include "SkImageFilter.h" #include "SkMaskFilter.h" #include "SkMaskGamma.h" -#include "SkMutex.h" #include "SkReadBuffer.h" #include "SkWriteBuffer.h" #include "SkPaintDefaults.h" diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index 9381f48f3b..daac0772dc 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -12,6 +12,7 @@ #include "SkPathPriv.h" #include "SkPathRef.h" #include "SkRRect.h" +#include "SkThread.h" //////////////////////////////////////////////////////////////////////////// @@ -1880,7 +1881,7 @@ size_t SkPath::readFromMemory(const void* storage, size_t length) { } unsigned version = packed & 0xFF; - + fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF; fFillType = (packed >> kFillType_SerializationShift) & 0xFF; uint8_t dir = (packed >> kDirection_SerializationShift) & 0x3; diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp index 082435f8c7..6e1f5c6417 100644 --- a/src/core/SkPixelRef.cpp +++ b/src/core/SkPixelRef.cpp @@ -6,8 +6,8 @@ */ #include "SkBitmapCache.h" -#include "SkMutex.h" #include "SkPixelRef.h" +#include "SkThread.h" #include "SkTraceEvent.h" //#define SK_SUPPORT_LEGACY_UNBALANCED_PIXELREF_LOCKCOUNT diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp index 05ba4f46a2..24d7248582 100644 --- a/src/core/SkRegion.cpp +++ b/src/core/SkRegion.cpp @@ -7,9 +7,9 @@ */ -#include "SkAtomics.h" #include "SkRegionPriv.h" #include "SkTemplates.h" +#include "SkThread.h" #include "SkUtils.h" /* Region Layout diff --git a/src/core/SkRegionPriv.h b/src/core/SkRegionPriv.h index 9ddefc06cc..00feedeab8 100644 --- a/src/core/SkRegionPriv.h +++ b/src/core/SkRegionPriv.h @@ -11,7 +11,7 @@ #define SkRegionPriv_DEFINED #include "SkRegion.h" -#include "SkAtomics.h" +#include "SkThread.h" #define assert_sentinel(value, isSentinel) \ SkASSERT(((value) == SkRegion::kRunTypeSentinel) == isSentinel) diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp index 6c76d350c3..f0fe72113e 100644 --- a/src/core/SkResourceCache.cpp +++ b/src/core/SkResourceCache.cpp @@ -8,7 +8,6 @@ #include "SkChecksum.h" #include "SkMessageBus.h" #include "SkMipMap.h" -#include "SkMutex.h" #include "SkPixelRef.h" #include "SkResourceCache.h" @@ -75,7 +74,7 @@ void SkResourceCache::init() { class SkOneShotDiscardablePixelRef : public SkPixelRef { public: - + // Ownership of the discardablememory is transfered to the pixelref SkOneShotDiscardablePixelRef(const SkImageInfo&, SkDiscardableMemory*, size_t rowBytes); ~SkOneShotDiscardablePixelRef(); @@ -237,7 +236,7 @@ static bool gDumpCacheTransactions; void SkResourceCache::add(Rec* rec) { this->checkMessages(); - + SkASSERT(rec); // See if we already have this key (racy inserts, etc.) Rec* existing = fHash->find(rec->getKey()); @@ -245,7 +244,7 @@ void SkResourceCache::add(Rec* rec) { SkDELETE(rec); return; } - + this->addToHead(rec); fHash->add(rec); @@ -358,7 +357,7 @@ size_t SkResourceCache::setTotalByteLimit(size_t newLimit) { SkCachedData* SkResourceCache::newCachedData(size_t bytes) { this->checkMessages(); - + if (fDiscardableFactory) { SkDiscardableMemory* dm = fDiscardableFactory(bytes); return dm ? SkNEW_ARGS(SkCachedData, (bytes, dm)) : NULL; @@ -516,6 +515,8 @@ void SkResourceCache::checkMessages() { /////////////////////////////////////////////////////////////////////////////// +#include "SkThread.h" + SK_DECLARE_STATIC_MUTEX(gMutex); static SkResourceCache* gResourceCache = NULL; static void cleanup_gResourceCache() { diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index b765aad97c..4ce42ddc07 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -21,6 +21,7 @@ #include "SkRasterizer.h" #include "SkRasterClip.h" #include "SkStroke.h" +#include "SkThread.h" #define ComputeBWRowBytes(width) (((unsigned)(width) + 7) >> 3) diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp index 32984960ab..f146345f9a 100644 --- a/src/core/SkShader.cpp +++ b/src/core/SkShader.cpp @@ -5,17 +5,17 @@ * found in the LICENSE file. */ -#include "SkAtomics.h" #include "SkBitmapProcShader.h" #include "SkColorShader.h" #include "SkEmptyShader.h" +#include "SkReadBuffer.h" #include "SkMallocPixelRef.h" #include "SkPaint.h" #include "SkPicture.h" #include "SkPictureShader.h" -#include "SkReadBuffer.h" #include "SkScalar.h" #include "SkShader.h" +#include "SkThread.h" #include "SkWriteBuffer.h" //#define SK_TRACK_SHADER_LIFETIME diff --git a/src/core/SkString.cpp b/src/core/SkString.cpp index 5c63a8b515..c10347dad1 100644 --- a/src/core/SkString.cpp +++ b/src/core/SkString.cpp @@ -7,9 +7,9 @@ */ -#include "SkAtomics.h" -#include "SkFixed.h" #include "SkString.h" +#include "SkFixed.h" +#include "SkThread.h" #include "SkUtils.h" #include #include diff --git a/src/core/SkTLS.cpp b/src/core/SkTLS.cpp index 346fed80ce..3f78a2434c 100755 --- a/src/core/SkTLS.cpp +++ b/src/core/SkTLS.cpp @@ -1,10 +1,3 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - #include "SkTLS.h" // enable to help debug TLS storage @@ -12,7 +5,7 @@ #ifdef SK_TRACE_TLS_LIFETIME - #include "SkAtomics.h" + #include "SkThread.h" static int32_t gTLSRecCount; #endif diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp index c94e22f2bc..2c7db68d87 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -10,7 +10,6 @@ #include "SkFontDescriptor.h" #include "SkFontMgr.h" #include "SkLazyPtr.h" -#include "SkMutex.h" #include "SkOTTable_OS_2.h" #include "SkStream.h" #include "SkTypeface.h" diff --git a/src/core/SkTypefaceCache.cpp b/src/core/SkTypefaceCache.cpp index 49779fcbe3..f253b60523 100644 --- a/src/core/SkTypefaceCache.cpp +++ b/src/core/SkTypefaceCache.cpp @@ -9,8 +9,7 @@ #include "SkTypefaceCache.h" -#include "SkAtomics.h" -#include "SkMutex.h" +#include "SkThread.h" #define TYPEFACE_CACHE_LIMIT 1024 diff --git a/src/fonts/SkFontMgr_fontconfig.cpp b/src/fonts/SkFontMgr_fontconfig.cpp index 0873aa105b..9294990c98 100644 --- a/src/fonts/SkFontMgr_fontconfig.cpp +++ b/src/fonts/SkFontMgr_fontconfig.cpp @@ -5,14 +5,14 @@ * found in the LICENSE file. */ -#include "SkFontConfigInterface.h" -#include "SkFontConfigTypeface.h" #include "SkFontMgr.h" #include "SkFontStyle.h" +#include "SkFontConfigInterface.h" +#include "SkFontConfigTypeface.h" #include "SkMath.h" -#include "SkMutex.h" #include "SkString.h" #include "SkTDArray.h" +#include "SkThread.h" // for now we pull these in directly. eventually we will solely rely on the // SkFontConfigInterface instance. diff --git a/src/fonts/SkTestScalerContext.cpp b/src/fonts/SkTestScalerContext.cpp index 50706f66c3..28b53b3a15 100644 --- a/src/fonts/SkTestScalerContext.cpp +++ b/src/fonts/SkTestScalerContext.cpp @@ -42,7 +42,7 @@ SkTestFont::~SkTestFont() { #ifdef SK_DEBUG -#include "SkMutex.h" +#include "SkThread.h" SK_DECLARE_STATIC_MUTEX(gUsedCharsMutex); #endif diff --git a/src/gpu/GrBatch.h b/src/gpu/GrBatch.h index 21dc3d21c8..eb385635bc 100644 --- a/src/gpu/GrBatch.h +++ b/src/gpu/GrBatch.h @@ -12,8 +12,8 @@ #include "GrBatchTarget.h" #include "GrGeometryProcessor.h" #include "GrVertices.h" -#include "SkAtomics.h" #include "SkRefCnt.h" +#include "SkThread.h" #include "SkTypes.h" class GrGpu; @@ -39,7 +39,7 @@ struct GrInitInvariantOutput; class GrBatch : public SkRefCnt { public: - + GrBatch() : fClassID(kIllegalBatchClassID), fNumberOfDraws(0) { SkDEBUGCODE(fUsed = false;) } virtual ~GrBatch() {} diff --git a/src/gpu/gl/GrGLNoOpInterface.cpp b/src/gpu/gl/GrGLNoOpInterface.cpp index f47f254424..396eaa46ea 100644 --- a/src/gpu/gl/GrGLNoOpInterface.cpp +++ b/src/gpu/gl/GrGLNoOpInterface.cpp @@ -6,8 +6,8 @@ */ #include "GrGLNoOpInterface.h" -#include "SkMutex.h" #include "SkString.h" +#include "SkThread.h" // the OpenGLES 2.0 spec says this must be >= 128 static const GrGLint kDefaultMaxVertexUniformVectors = 128; diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp index 70072c6b8c..5b9d87ff2f 100644 --- a/src/lazy/SkDiscardableMemoryPool.cpp +++ b/src/lazy/SkDiscardableMemoryPool.cpp @@ -9,8 +9,8 @@ #include "SkDiscardableMemoryPool.h" #include "SkImageGenerator.h" #include "SkLazyPtr.h" -#include "SkMutex.h" #include "SkTInternalLList.h" +#include "SkThread.h" // Note: // A PoolDiscardableMemory is memory that is counted in a pool. diff --git a/src/pathops/SkPathOpsDebug.cpp b/src/pathops/SkPathOpsDebug.cpp index 643ff1d29f..627a7c9f40 100644 --- a/src/pathops/SkPathOpsDebug.cpp +++ b/src/pathops/SkPathOpsDebug.cpp @@ -5,10 +5,10 @@ * found in the LICENSE file. */ -#include "SkMutex.h" -#include "SkPath.h" #include "SkPathOpsDebug.h" +#include "SkPath.h" #include "SkString.h" +#include "SkThread.h" #if DEBUG_VALIDATE extern bool FLAGS_runFail; @@ -304,7 +304,7 @@ SkString SkOpAngle::debugPart() const { break; default: SkASSERT(0); - } + } return result; } #endif diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp index 8589cc2421..239a7905ed 100644 --- a/src/ports/SkFontConfigInterface_direct.cpp +++ b/src/ports/SkFontConfigInterface_direct.cpp @@ -15,7 +15,6 @@ #include "SkBuffer.h" #include "SkFontConfigInterface.h" #include "SkLazyPtr.h" -#include "SkMutex.h" #include "SkStream.h" #include "SkString.h" diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 6f235edb8f..c0278317ff 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -17,12 +17,12 @@ #include "SkMask.h" #include "SkMaskGamma.h" #include "SkMatrix22.h" -#include "SkMutex.h" #include "SkOTUtils.h" #include "SkScalerContext.h" #include "SkStream.h" #include "SkString.h" #include "SkTemplates.h" +#include "SkThread.h" #include "SkTypes.h" #if defined(SK_CAN_USE_DLOPEN) diff --git a/src/ports/SkFontHost_FreeType_common.h b/src/ports/SkFontHost_FreeType_common.h index a9ca42b35f..8ae872c1da 100644 --- a/src/ports/SkFontHost_FreeType_common.h +++ b/src/ports/SkFontHost_FreeType_common.h @@ -10,7 +10,6 @@ #define SKFONTHOST_FREETYPE_COMMON_H_ #include "SkGlyph.h" -#include "SkMutex.h" #include "SkScalerContext.h" #include "SkTypeface.h" #include "SkTypes.h" diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index 5ad1c2fb5e..22e2954705 100755 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -24,13 +24,12 @@ #include "SkColorPriv.h" #include "SkDescriptor.h" #include "SkEndian.h" -#include "SkFloatingPoint.h" #include "SkFontDescriptor.h" -#include "SkFontMgr.h" +#include "SkFloatingPoint.h" #include "SkGlyph.h" #include "SkLazyFnPtr.h" #include "SkMaskGamma.h" -#include "SkMutex.h" +#include "SkSFNTHeader.h" #include "SkOTTable_glyf.h" #include "SkOTTable_head.h" #include "SkOTTable_hhea.h" @@ -38,12 +37,13 @@ #include "SkOTUtils.h" #include "SkPaint.h" #include "SkPath.h" -#include "SkSFNTHeader.h" -#include "SkStream.h" #include "SkString.h" -#include "SkTypefaceCache.h" +#include "SkStream.h" +#include "SkThread.h" #include "SkTypeface_mac.h" #include "SkUtils.h" +#include "SkTypefaceCache.h" +#include "SkFontMgr.h" #include "SkUtils.h" #include diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 7463dabee2..bcbbe11288 100755 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -23,6 +23,7 @@ #include "SkStream.h" #include "SkString.h" #include "SkTemplates.h" +#include "SkThread.h" #include "SkTypeface_win.h" #include "SkTypefaceCache.h" #include "SkUtils.h" diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp index cea0b4875e..49744a1f63 100644 --- a/src/ports/SkFontMgr_custom.cpp +++ b/src/ports/SkFontMgr_custom.cpp @@ -15,6 +15,7 @@ #include "SkRTConf.h" #include "SkString.h" #include "SkStream.h" +#include "SkThread.h" #include "SkTSearch.h" #include "SkTypefaceCache.h" #include "SkTArray.h" diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp index 7000e31db4..c3cb26751e 100644 --- a/src/ports/SkFontMgr_fontconfig.cpp +++ b/src/ports/SkFontMgr_fontconfig.cpp @@ -11,10 +11,10 @@ #include "SkFontMgr.h" #include "SkFontStyle.h" #include "SkMath.h" -#include "SkMutex.h" #include "SkString.h" #include "SkStream.h" #include "SkTDArray.h" +#include "SkThread.h" #include "SkTypefaceCache.h" #include "SkOSFile.h" diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp index ca8b260580..b0cdf3c036 100644 --- a/src/ports/SkFontMgr_win_dw.cpp +++ b/src/ports/SkFontMgr_win_dw.cpp @@ -9,9 +9,9 @@ #include "SkDWriteFontFileStream.h" #include "SkFontMgr.h" #include "SkHRESULT.h" -#include "SkMutex.h" #include "SkStream.h" #include "SkTScopedComPtr.h" +#include "SkThread.h" #include "SkTypeface.h" #include "SkTypefaceCache.h" #include "SkTypeface_win_dw.h" diff --git a/src/ports/SkRemotableFontMgr_win_dw.cpp b/src/ports/SkRemotableFontMgr_win_dw.cpp index 006346acab..d787a95374 100644 --- a/src/ports/SkRemotableFontMgr_win_dw.cpp +++ b/src/ports/SkRemotableFontMgr_win_dw.cpp @@ -5,15 +5,15 @@ * found in the LICENSE file. */ +#include "SkDataTable.h" #include "SkDWrite.h" #include "SkDWriteFontFileStream.h" -#include "SkDataTable.h" #include "SkHRESULT.h" -#include "SkMutex.h" #include "SkRemotableFontMgr.h" #include "SkStream.h" #include "SkString.h" #include "SkTArray.h" +#include "SkThread.h" #include "SkTScopedComPtr.h" #include "SkTypeface_win.h" #include "SkTypes.h" @@ -80,7 +80,7 @@ private: } public: - + /** localeNameLength must include the null terminator. */ SkRemotableFontMgr_DirectWrite(IDWriteFontCollection* fontCollection, diff --git a/src/ports/SkTLS_win.cpp b/src/ports/SkTLS_win.cpp index c6f3dfc638..dea8cd4d6b 100644 --- a/src/ports/SkTLS_win.cpp +++ b/src/ports/SkTLS_win.cpp @@ -6,7 +6,7 @@ */ #include "SkTLS.h" -#include "SkMutex.h" +#include "SkThread.h" static bool gOnce = false; static DWORD gTlsIndex; diff --git a/src/views/SkEvent.cpp b/src/views/SkEvent.cpp index 5f204c0f0f..52a0c4dd7f 100644 --- a/src/views/SkEvent.cpp +++ b/src/views/SkEvent.cpp @@ -265,7 +265,7 @@ void SkEvent::inflate(const SkDOM& dom, const SkDOM::Node* node) #define EVENT_LOGN(s, n) #endif -#include "SkMutex.h" +#include "SkThread.h" #include "SkTime.h" class SkEvent_Globals { diff --git a/src/views/SkEventSink.cpp b/src/views/SkEventSink.cpp index 42c1ceb062..7763adef54 100644 --- a/src/views/SkEventSink.cpp +++ b/src/views/SkEventSink.cpp @@ -8,8 +8,10 @@ #include "SkEventSink.h" -#include "SkMutex.h" #include "SkTagList.h" +#include "SkThread.h" + +#include "SkThread.h" #include "SkTime.h" class SkEventSink_Globals { @@ -254,7 +256,7 @@ SkEventSink* SkEventSink::FindSink(SkEventSinkID sinkID) #if 0 // experimental, not tested -#include "SkMutex.h" +#include "SkThread.h" #include "SkTDict.h" #define kMinStringBufferSize 128 diff --git a/src/views/SkOSMenu.cpp b/src/views/SkOSMenu.cpp index 8c2e47602f..ad0c73f80d 100644 --- a/src/views/SkOSMenu.cpp +++ b/src/views/SkOSMenu.cpp @@ -4,9 +4,9 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkAtomics.h" -#include "SkOSMenu.h" #include +#include "SkOSMenu.h" +#include "SkThread.h" static int gOSMenuCmd = 7000; diff --git a/tests/AtomicTest.cpp b/tests/AtomicTest.cpp index 7eb7a7103b..8b5ac9b679 100644 --- a/tests/AtomicTest.cpp +++ b/tests/AtomicTest.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkAtomics.h" +#include "SkThread.h" #include "SkThreadUtils.h" #include "SkTypes.h" #include "Test.h" diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp index 69a2d617b0..df80f4673e 100644 --- a/tests/PathOpsExtendedTest.cpp +++ b/tests/PathOpsExtendedTest.cpp @@ -11,10 +11,10 @@ #include "SkCanvas.h" #include "SkForceLinking.h" #include "SkMatrix.h" -#include "SkMutex.h" #include "SkPaint.h" #include "SkRTConf.h" #include "SkStream.h" +#include "SkThread.h" #ifdef SK_BUILD_FOR_MAC #include diff --git a/tests/PathOpsExtendedTest.h b/tests/PathOpsExtendedTest.h index f8d74098ce..c4baa63b51 100644 --- a/tests/PathOpsExtendedTest.h +++ b/tests/PathOpsExtendedTest.h @@ -12,6 +12,8 @@ #include "SkPath.h" #include "SkPathOpsTypes.h" #include "SkStream.h" +#include "SkThread.h" +#include "SkThreadUtils.h" #include "Test.h" DECLARE_bool(runFail); diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp index 00043c1749..2c1822d38b 100644 --- a/tests/skia_test.cpp +++ b/tests/skia_test.cpp @@ -8,7 +8,6 @@ #include "CrashHandler.h" #include "OverwriteLine.h" #include "Resources.h" -#include "SkAtomics.h" #include "SkCommonFlags.h" #include "SkGraphics.h" #include "SkOSFile.h" @@ -16,6 +15,7 @@ #include "SkTArray.h" #include "SkTaskGroup.h" #include "SkTemplates.h" +#include "SkThread.h" #include "SkTime.h" #include "Test.h" diff --git a/tools/sk_tool_utils_font.cpp b/tools/sk_tool_utils_font.cpp index 7b95fb04e0..925bd7dc76 100644 --- a/tools/sk_tool_utils_font.cpp +++ b/tools/sk_tool_utils_font.cpp @@ -7,9 +7,9 @@ #include "Resources.h" #include "SkFontMgr.h" -#include "SkMutex.h" #include "SkOSFile.h" #include "SkTestScalerContext.h" +#include "SkThread.h" #include "SkUtils.h" #include "sk_tool_utils.h" diff --git a/tools/skpdiff/SkDiffContext.h b/tools/skpdiff/SkDiffContext.h index 9347d2651f..8f4789fea6 100644 --- a/tools/skpdiff/SkDiffContext.h +++ b/tools/skpdiff/SkDiffContext.h @@ -9,11 +9,11 @@ #define SkDiffContext_DEFINED #include "SkImageDiffer.h" -#include "SkMutex.h" #include "SkString.h" #include "SkTArray.h" #include "SkTDArray.h" #include "SkTLList.h" +#include "SkThread.h" class SkWStream; @@ -52,7 +52,7 @@ public: void setWhiteDiffDir(const SkString& directory); /** - * Modify the pattern used to generate commonName (= the + * Modify the pattern used to generate commonName (= the * basename of rgb/white diff files). * * - true: basename is a combination of the input file names. @@ -61,10 +61,10 @@ public: * For example, for: * baselinePath=/tmp/dir/image-before.png * testPath=/tmp/dir/image-after.png - * + * * If setLongNames(true), commonName would be: * image-before-png-vs-image-after-png.png - * + * * If setLongNames(false), commonName would be: * image-.png */ @@ -104,8 +104,8 @@ public: * * The format of the JSON document is one top level array named "records". * Each record in the array is an object with the following values: - * "commonName" : string containing the output filename (basename) - * depending on the value of 'longNames'. + * "commonName" : string containing the output filename (basename) + * depending on the value of 'longNames'. * (see 'setLongNames' for an explanation and example). * "baselinePath" : string containing the path to the baseline image * "testPath" : string containing the path to the test image -- cgit v1.2.3