mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Remove skia::RefPtr (flutter/engine#2851)
Also, remove the hacks that integrate Skia ref counting with WTF. Now we just use sk_sp everywhere for managing Skia ref counts.
This commit is contained in:
parent
0c9bcdd22e
commit
3fbc245f7e
@ -13,7 +13,6 @@
|
||||
#include "glue/trace_event.h"
|
||||
#include "lib/ftl/logging.h"
|
||||
#include "lib/ftl/macros.h"
|
||||
#include "skia/ext/refptr.h"
|
||||
#include "third_party/skia/include/core/SkCanvas.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "third_party/skia/include/core/SkColorFilter.h"
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
|
||||
#include "flow/instrumentation.h"
|
||||
#include "lib/ftl/macros.h"
|
||||
#include "skia/ext/refptr.h"
|
||||
#include "third_party/skia/include/core/SkImage.h"
|
||||
#include "third_party/skia/include/core/SkSize.h"
|
||||
|
||||
|
||||
@ -133,7 +133,6 @@ config("skia_config") {
|
||||
"SK_HAS_JPEG_LIBRARY",
|
||||
"SK_HAS_PNG_LIBRARY",
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
# Internal-facing config for Skia library code.
|
||||
@ -270,7 +269,6 @@ component("skia") {
|
||||
"ext/google_logging.cc",
|
||||
"ext/image_operations.cc",
|
||||
"ext/image_operations.h",
|
||||
"ext/refptr.h",
|
||||
]
|
||||
|
||||
# The skia gypi values are relative to the skia_dir, so we need to rebase.
|
||||
@ -280,7 +278,7 @@ component("skia") {
|
||||
|
||||
sources += [
|
||||
"//third_party/skia/src/ports/SkImageGenerator_skia.cpp",
|
||||
|
||||
|
||||
"//third_party/skia/src/codec/SkAndroidCodec.cpp",
|
||||
"//third_party/skia/src/codec/SkBmpCodec.cpp",
|
||||
"//third_party/skia/src/codec/SkBmpMaskCodec.cpp",
|
||||
|
||||
@ -166,12 +166,6 @@
|
||||
|
||||
// ===== Begin Chrome-specific definitions =====
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
#define SK_REF_CNT_MIXIN_INCLUDE "sk_ref_cnt_ext_debug.h"
|
||||
#else
|
||||
#define SK_REF_CNT_MIXIN_INCLUDE "sk_ref_cnt_ext_release.h"
|
||||
#endif
|
||||
|
||||
#define SK_SCALAR_IS_FLOAT
|
||||
#undef SK_SCALAR_IS_FIXED
|
||||
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
// Copyright 2013 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SK_REF_CNT_EXT_DEBUG_H_
|
||||
#define SK_REF_CNT_EXT_DEBUG_H_
|
||||
|
||||
#ifdef SK_REF_CNT_EXT_RELEASE_H_
|
||||
#error Only one SkRefCnt should be used.
|
||||
#endif
|
||||
|
||||
// Alternate implementation of SkRefCnt for Chromium debug builds
|
||||
class SK_API SkRefCnt : public SkRefCntBase {
|
||||
public:
|
||||
SkRefCnt() : flags_(0) {}
|
||||
void ref() const { SkASSERT(flags_ != AdoptionRequired_Flag); SkRefCntBase::ref(); }
|
||||
void adopted() const { flags_ |= Adopted_Flag; }
|
||||
void requireAdoption() const { flags_ |= AdoptionRequired_Flag; }
|
||||
void deref() const { SkRefCntBase::unref(); }
|
||||
private:
|
||||
enum {
|
||||
Adopted_Flag = 0x1,
|
||||
AdoptionRequired_Flag = 0x2,
|
||||
};
|
||||
|
||||
mutable int flags_;
|
||||
};
|
||||
|
||||
// Bootstrap for Blink's WTF::RefPtr
|
||||
|
||||
namespace WTF {
|
||||
inline void adopted(const SkRefCnt* object) {
|
||||
if (!object)
|
||||
return;
|
||||
object->adopted();
|
||||
}
|
||||
inline void requireAdoption(const SkRefCnt* object) {
|
||||
if (!object)
|
||||
return;
|
||||
object->requireAdoption();
|
||||
}
|
||||
};
|
||||
|
||||
using WTF::adopted;
|
||||
using WTF::requireAdoption;
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
// Copyright 2013 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SK_REF_CNT_EXT_RELEASE_H_
|
||||
#define SK_REF_CNT_EXT_RELEASE_H_
|
||||
|
||||
#ifdef SK_REF_CNT_EXT_DEBUG_H_
|
||||
#error Only one SkRefCnt should be used.
|
||||
#endif
|
||||
|
||||
// Alternate implementation of SkRefCnt for Chromium release builds
|
||||
class SK_API SkRefCnt : public SkRefCntBase {
|
||||
public:
|
||||
void deref() const { SkRefCntBase::unref(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user