Remove WTF::WeakPtr entirely and replace it with base::WeakPtr.
This CL deletes platform/wtf/WeakPtr.h and replaces and code
that was still using it in WebKit/ with base::WeakPtr(Factory).
In some cases the file was included but was not needed, so
we just delete the header.
Bug: 789697
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I60409333fb2cc49be475521b51b65c76824811d9
Reviewed-on: https://chromium-review.googlesource.com/798810
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Stuart Langley <slangley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521213}
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
index 431e229..77e831a 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -1017,7 +1017,7 @@
// Avoid creating |contextProvider| until we're sure we want to try use it,
// since it costs us GPU memory.
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper =
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper =
SharedGpuContext::ContextProviderWrapper();
if (!context_provider_wrapper) {
CanvasMetrics::CountCanvasContextUsage(
@@ -1442,7 +1442,7 @@
void HTMLCanvasElement::SetPlaceholderFrame(
scoped_refptr<StaticBitmapImage> image,
- WeakPtr<OffscreenCanvasFrameDispatcher> dispatcher,
+ base::WeakPtr<OffscreenCanvasFrameDispatcher> dispatcher,
scoped_refptr<WebTaskRunner> task_runner,
unsigned resource_id) {
OffscreenCanvasPlaceholder::SetPlaceholderFrame(
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.h b/third_party/WebKit/Source/core/html/HTMLCanvasElement.h
index f1dbae13..8389b7c 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.h
@@ -30,6 +30,7 @@
#include <memory>
+#include "base/memory/weak_ptr.h"
#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/v8_blob_callback.h"
#include "core/CoreExport.h"
@@ -218,7 +219,7 @@
// OffscreenCanvasPlaceholder implementation.
void SetPlaceholderFrame(scoped_refptr<StaticBitmapImage>,
- WeakPtr<OffscreenCanvasFrameDispatcher>,
+ base::WeakPtr<OffscreenCanvasFrameDispatcher>,
scoped_refptr<WebTaskRunner>,
unsigned resource_id) override;
virtual void Trace(blink::Visitor*);
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.cpp
index 6728314..ba315f3 100644
--- a/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.cpp
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.cpp
@@ -13,7 +13,7 @@
void CanvasDrawListener::SendNewFrame(
sk_sp<SkImage> image,
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider) {
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider) {
handler_->SendNewFrame(
image, context_provider ? context_provider->ContextProvider() : nullptr);
}
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.h b/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.h
index 90d5712..d0986d66 100644
--- a/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.h
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.h
@@ -6,9 +6,10 @@
#define CanvasDrawListener_h
#include <memory>
+
+#include "base/memory/weak_ptr.h"
#include "core/CoreExport.h"
#include "platform/heap/Handle.h"
-#include "platform/wtf/WeakPtr.h"
#include "public/platform/WebCanvasCaptureHandler.h"
#include "third_party/skia/include/core/SkRefCnt.h"
@@ -22,7 +23,7 @@
public:
virtual ~CanvasDrawListener();
virtual void SendNewFrame(sk_sp<SkImage>,
- WeakPtr<WebGraphicsContext3DProviderWrapper>);
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>);
bool NeedsNewFrame() const;
void RequestFrame();
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
index 4e44f42..a75d878 100644
--- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
@@ -86,12 +86,12 @@
#endif
-WeakPtr<BackgroundHTMLParser> BackgroundHTMLParser::Create(
+base::WeakPtr<BackgroundHTMLParser> BackgroundHTMLParser::Create(
std::unique_ptr<Configuration> config,
scoped_refptr<WebTaskRunner> loading_task_runner) {
auto* background_parser = new BackgroundHTMLParser(
std::move(config), std::move(loading_task_runner));
- return background_parser->weak_factory_.CreateWeakPtr();
+ return background_parser->weak_factory_.GetWeakPtr();
}
void BackgroundHTMLParser::Init(
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h
index c57f279..d8cc4db 100644
--- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h
+++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h
@@ -29,6 +29,7 @@
#include <memory>
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "core/dom/DocumentEncodingData.h"
#include "core/html/parser/BackgroundHTMLInputStream.h"
#include "core/html/parser/CompactHTMLToken.h"
@@ -39,7 +40,6 @@
#include "core/html/parser/TextResourceDecoder.h"
#include "core/html/parser/TokenizedChunkQueue.h"
#include "core/html/parser/XSSAuditorDelegate.h"
-#include "platform/wtf/WeakPtr.h"
namespace blink {
@@ -57,7 +57,7 @@
public:
Configuration();
HTMLParserOptions options;
- WeakPtr<HTMLDocumentParser> parser;
+ base::WeakPtr<HTMLDocumentParser> parser;
std::unique_ptr<XSSAuditor> xss_auditor;
std::unique_ptr<TextResourceDecoder> decoder;
scoped_refptr<TokenizedChunkQueue> tokenized_chunk_queue;
@@ -71,8 +71,9 @@
// The returned BackgroundHTMLParser should only be used on the parser
// thread: it must first be initialized by calling init(), and free by
// calling stop().
- static WeakPtr<BackgroundHTMLParser> Create(std::unique_ptr<Configuration>,
- scoped_refptr<WebTaskRunner>);
+ static base::WeakPtr<BackgroundHTMLParser> Create(
+ std::unique_ptr<Configuration>,
+ scoped_refptr<WebTaskRunner>);
void Init(const KURL& document_url,
std::unique_ptr<CachedDocumentParameters>,
const MediaValuesCached::MediaValuesCachedData&);
@@ -81,7 +82,7 @@
USING_FAST_MALLOC(Checkpoint);
public:
- WeakPtr<HTMLDocumentParser> parser;
+ base::WeakPtr<HTMLDocumentParser> parser;
std::unique_ptr<HTMLToken> token;
std::unique_ptr<HTMLTokenizer> tokenizer;
HTMLTreeBuilderSimulator::State tree_builder_state;
@@ -118,7 +119,7 @@
template <typename FunctionType, typename... Ps>
void RunOnMainThread(FunctionType, Ps&&...);
- WeakPtrFactory<BackgroundHTMLParser> weak_factory_;
+ base::WeakPtrFactory<BackgroundHTMLParser> weak_factory_;
BackgroundHTMLInputStream input_;
HTMLSourceTracker source_tracker_;
std::unique_ptr<HTMLToken> token_;
@@ -126,7 +127,7 @@
HTMLTreeBuilderSimulator tree_builder_simulator_;
HTMLParserOptions options_;
const size_t outstanding_token_limit_;
- WeakPtr<HTMLDocumentParser> parser_;
+ base::WeakPtr<HTMLDocumentParser> parser_;
std::unique_ptr<CompactHTMLTokenStream> pending_tokens_;
const size_t pending_token_limit_;
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
index 2b83b82..8a1a8bd3 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -432,7 +432,7 @@
std::unique_ptr<TokenizedChunk> last_chunk_before_script,
std::unique_ptr<HTMLToken> token,
std::unique_ptr<HTMLTokenizer> tokenizer) {
- weak_factory_.RevokeAll();
+ weak_factory_.InvalidateWeakPtrs();
size_t discarded_token_count = 0;
for (const auto& speculation : speculations_) {
@@ -448,7 +448,7 @@
std::unique_ptr<BackgroundHTMLParser::Checkpoint> checkpoint =
WTF::WrapUnique(new BackgroundHTMLParser::Checkpoint);
- checkpoint->parser = weak_factory_.CreateWeakPtr();
+ checkpoint->parser = weak_factory_.GetWeakPtr();
checkpoint->token = std::move(token);
checkpoint->tokenizer = std::move(tokenizer);
checkpoint->tree_builder_state =
@@ -814,7 +814,7 @@
std::unique_ptr<BackgroundHTMLParser::Configuration> config =
WTF::WrapUnique(new BackgroundHTMLParser::Configuration);
config->options = options_;
- config->parser = weak_factory_.CreateWeakPtr();
+ config->parser = weak_factory_.GetWeakPtr();
config->xss_auditor = WTF::WrapUnique(new XSSAuditor);
config->xss_auditor->Init(GetDocument(), &xss_auditor_delegate_);
@@ -862,7 +862,7 @@
// Make this sync, as lsan triggers on some unittests if the task runner is
// used.
background_parser_->Stop();
- weak_factory_.RevokeAll();
+ weak_factory_.InvalidateWeakPtrs();
}
void HTMLDocumentParser::Append(const String& input_source) {
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h
index 7bc46da..80409d3 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h
@@ -28,6 +28,7 @@
#include <memory>
#include "base/memory/scoped_refptr.h"
+#include "base/memory/weak_ptr.h"
#include "core/CoreExport.h"
#include "core/dom/ParserContentPolicy.h"
#include "core/dom/ScriptableDocumentParser.h"
@@ -48,7 +49,6 @@
#include "core/html/parser/XSSAuditorDelegate.h"
#include "platform/bindings/TraceWrapperMember.h"
#include "platform/wtf/Deque.h"
-#include "platform/wtf/WeakPtr.h"
#include "platform/wtf/text/TextPosition.h"
namespace blink {
@@ -259,8 +259,8 @@
// Using WeakPtr for GarbageCollected is discouraged. But in this case this is
// ok because HTMLDocumentParser guarantees to revoke all WeakPtrs in the pre
// finalizer.
- WeakPtrFactory<HTMLDocumentParser> weak_factory_;
- WeakPtr<BackgroundHTMLParser> background_parser_;
+ base::WeakPtrFactory<HTMLDocumentParser> weak_factory_;
+ base::WeakPtr<BackgroundHTMLParser> background_parser_;
Member<HTMLResourcePreloader> preloader_;
PreloadRequestStream queued_preloads_;
scoped_refptr<TokenizedChunkQueue> tokenized_chunk_queue_;
diff --git a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp
index 31c93b8..f23e91a 100644
--- a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp
+++ b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp
@@ -26,7 +26,8 @@
scoped_refptr<AcceleratedStaticBitmapImage>
AcceleratedStaticBitmapImage::CreateFromSkImage(
sk_sp<SkImage> image,
- WeakPtr<WebGraphicsContext3DProviderWrapper>&& context_provider_wrapper) {
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&
+ context_provider_wrapper) {
DCHECK(image->isTextureBacked());
return base::AdoptRef(new AcceleratedStaticBitmapImage(
std::move(image), std::move(context_provider_wrapper)));
@@ -37,7 +38,8 @@
const gpu::Mailbox& mailbox,
const gpu::SyncToken& sync_token,
unsigned texture_id,
- WeakPtr<WebGraphicsContext3DProviderWrapper>&& context_provider_wrapper,
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&
+ context_provider_wrapper,
IntSize mailbox_size) {
return base::AdoptRef(new AcceleratedStaticBitmapImage(
mailbox, sync_token, texture_id, std::move(context_provider_wrapper),
@@ -46,7 +48,8 @@
AcceleratedStaticBitmapImage::AcceleratedStaticBitmapImage(
sk_sp<SkImage> image,
- WeakPtr<WebGraphicsContext3DProviderWrapper>&& context_provider_wrapper) {
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&
+ context_provider_wrapper) {
texture_holder_ = WTF::WrapUnique(new SkiaTextureHolder(
std::move(image), std::move(context_provider_wrapper)));
thread_checker_.DetachFromThread();
@@ -56,7 +59,8 @@
const gpu::Mailbox& mailbox,
const gpu::SyncToken& sync_token,
unsigned texture_id,
- WeakPtr<WebGraphicsContext3DProviderWrapper>&& context_provider_wrapper,
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&
+ context_provider_wrapper,
IntSize mailbox_size) {
texture_holder_ = WTF::WrapUnique(new MailboxTextureHolder(
mailbox, sync_token, texture_id, std::move(context_provider_wrapper),
@@ -68,7 +72,7 @@
void DestroySkImageOnOriginalThread(
sk_sp<SkImage> image,
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper,
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper,
std::unique_ptr<gpu::SyncToken> sync_token) {
if (context_provider_wrapper &&
image->isValid(
@@ -214,7 +218,7 @@
return texture_holder_->ContextProvider();
}
-WeakPtr<WebGraphicsContext3DProviderWrapper>
+base::WeakPtr<WebGraphicsContext3DProviderWrapper>
AcceleratedStaticBitmapImage::ContextProviderWrapper() const {
if (!IsValid())
return nullptr;
diff --git a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
index 0e31bc3..629ffaa0 100644
--- a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
+++ b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
@@ -5,10 +5,10 @@
#ifndef AcceleratedStaticBitmapImage_h
#define AcceleratedStaticBitmapImage_h
+#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "platform/graphics/StaticBitmapImage.h"
#include "platform/graphics/TextureHolder.h"
-#include "platform/wtf/WeakPtr.h"
#include <memory>
@@ -25,22 +25,24 @@
// SkImage with a texture backing.
static scoped_refptr<AcceleratedStaticBitmapImage> CreateFromSkImage(
sk_sp<SkImage>,
- WeakPtr<WebGraphicsContext3DProviderWrapper>&&);
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&);
// Can specify the GrContext that created the texture backing. Ideally all
// callers would use this option. The |mailbox| is a name for the texture
// backing, allowing other contexts to use the same backing.
static scoped_refptr<AcceleratedStaticBitmapImage>
- CreateFromWebGLContextImage(const gpu::Mailbox&,
- const gpu::SyncToken&,
- unsigned texture_id,
- WeakPtr<WebGraphicsContext3DProviderWrapper>&&,
- IntSize mailbox_size);
+ CreateFromWebGLContextImage(
+ const gpu::Mailbox&,
+ const gpu::SyncToken&,
+ unsigned texture_id,
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&,
+ IntSize mailbox_size);
bool CurrentFrameKnownToBeOpaque(MetadataMode = kUseCurrentMetadata) override;
IntSize Size() const override;
bool IsTextureBacked() const override { return true; }
scoped_refptr<StaticBitmapImage> MakeAccelerated(
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_wrapper) override {
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_wrapper)
+ override {
NOTREACHED(); // IsTextureBacked() is already true.
return nullptr;
}
@@ -55,7 +57,7 @@
bool IsValid() const final;
WebGraphicsContext3DProvider* ContextProvider() const final;
- WeakPtr<WebGraphicsContext3DProviderWrapper> ContextProviderWrapper()
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> ContextProviderWrapper()
const final;
scoped_refptr<StaticBitmapImage> MakeUnaccelerated() final;
@@ -89,13 +91,15 @@
void Abandon() final;
private:
- AcceleratedStaticBitmapImage(sk_sp<SkImage>,
- WeakPtr<WebGraphicsContext3DProviderWrapper>&&);
- AcceleratedStaticBitmapImage(const gpu::Mailbox&,
- const gpu::SyncToken&,
- unsigned texture_id,
- WeakPtr<WebGraphicsContext3DProviderWrapper>&&,
- IntSize mailbox_size);
+ AcceleratedStaticBitmapImage(
+ sk_sp<SkImage>,
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&);
+ AcceleratedStaticBitmapImage(
+ const gpu::Mailbox&,
+ const gpu::SyncToken&,
+ unsigned texture_id,
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&,
+ IntSize mailbox_size);
void CreateImageFromMailboxIfNeeded();
void CheckThread();
@@ -110,7 +114,7 @@
sk_sp<SkImage> original_skia_image_;
scoped_refptr<WebTaskRunner> original_skia_image_task_runner_;
PlatformThreadId original_skia_image_thread_id_;
- WeakPtr<WebGraphicsContext3DProviderWrapper>
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>
original_skia_image_context_provider_wrapper_;
};
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
index fbb8b925..960e0112 100644
--- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
+++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
@@ -626,7 +626,7 @@
task_runner_->PostTask(
BLINK_FROM_HERE,
WTF::Bind(&BitmapImage::NotifyObserversOfAnimationAdvance,
- weak_factory_.CreateWeakPtr(), nullptr));
+ weak_factory_.GetWeakPtr(), nullptr));
// Reset the |desired_frame_start_time_| to the time for starting the
// |current_frame_index_|. Whenever StartAnimationInternal decides to schedule
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.h b/third_party/WebKit/Source/platform/graphics/BitmapImage.h
index 22f11ef1..e0c0b0a 100644
--- a/third_party/WebKit/Source/platform/graphics/BitmapImage.h
+++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.h
@@ -29,6 +29,7 @@
#define BitmapImage_h
#include <memory>
+#include "base/memory/weak_ptr.h"
#include "platform/Timer.h"
#include "platform/geometry/IntSize.h"
#include "platform/graphics/Color.h"
@@ -237,7 +238,7 @@
// during catch-up.
Optional<size_t> last_num_frames_skipped_ = 0u;
- WTF::WeakPtrFactory<BitmapImage> weak_factory_;
+ base::WeakPtrFactory<BitmapImage> weak_factory_;
};
DEFINE_IMAGE_TYPE_CASTS(BitmapImage);
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
index 519442d..a31945e 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -128,7 +128,7 @@
hint == kPreferAccelerationAfterVisibilityChange;
}
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper =
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper =
SharedGpuContext::ContextProviderWrapper();
if (accelerate && (!context_provider_wrapper ||
context_provider_wrapper->ContextProvider()
@@ -155,7 +155,7 @@
return ShouldAccelerate(kPreferAcceleration);
}
-static void HibernateWrapper(WeakPtr<Canvas2DLayerBridge> bridge,
+static void HibernateWrapper(base::WeakPtr<Canvas2DLayerBridge> bridge,
double /*idleDeadline*/) {
if (bridge) {
bridge->Hibernate();
@@ -167,7 +167,8 @@
}
}
-static void HibernateWrapperForTesting(WeakPtr<Canvas2DLayerBridge> bridge) {
+static void HibernateWrapperForTesting(
+ base::WeakPtr<Canvas2DLayerBridge> bridge) {
HibernateWrapper(bridge, 0);
}
@@ -428,11 +429,11 @@
if (dont_use_idle_scheduling_for_testing_) {
Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostTask(
BLINK_FROM_HERE, WTF::Bind(&HibernateWrapperForTesting,
- weak_ptr_factory_.CreateWeakPtr()));
+ weak_ptr_factory_.GetWeakPtr()));
} else {
Platform::Current()->CurrentThread()->Scheduler()->PostIdleTask(
BLINK_FROM_HERE,
- WTF::Bind(&HibernateWrapper, weak_ptr_factory_.CreateWeakPtr()));
+ WTF::Bind(&HibernateWrapper, weak_ptr_factory_.GetWeakPtr()));
}
}
if (!IsHidden() && software_rendering_while_hidden_) {
@@ -584,7 +585,7 @@
gpu::gles2::GLES2Interface* shared_gl = nullptr;
layer_->ClearTexture();
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper =
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper =
SharedGpuContext::ContextProviderWrapper();
if (context_provider_wrapper)
shared_gl = context_provider_wrapper->ContextProvider()->ContextGL();
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h
index 2996480..f4325cb4 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h
@@ -29,6 +29,7 @@
#include <memory>
#include "base/memory/scoped_refptr.h"
+#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
#include "cc/layers/texture_layer_client.h"
#include "platform/PlatformExport.h"
@@ -40,7 +41,6 @@
#include "platform/wtf/CheckedNumeric.h"
#include "platform/wtf/Deque.h"
#include "platform/wtf/RefCounted.h"
-#include "platform/wtf/WeakPtr.h"
#include "public/platform/WebExternalTextureLayer.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/skia/include/core/SkRefCnt.h"
@@ -173,7 +173,7 @@
std::unique_ptr<WebExternalTextureLayer> layer_;
std::unique_ptr<SharedContextRateLimiter> rate_limiter_;
std::unique_ptr<Logger> logger_;
- WeakPtrFactory<Canvas2DLayerBridge> weak_ptr_factory_;
+ base::WeakPtrFactory<Canvas2DLayerBridge> weak_ptr_factory_;
ImageBuffer* image_buffer_;
int msaa_sample_count_;
int frames_since_last_commit_ = 0;
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasResource.cpp b/third_party/WebKit/Source/platform/graphics/CanvasResource.cpp
index 6145df5..7824dac 100644
--- a/third_party/WebKit/Source/platform/graphics/CanvasResource.cpp
+++ b/third_party/WebKit/Source/platform/graphics/CanvasResource.cpp
@@ -14,7 +14,7 @@
namespace blink {
CanvasResource::CanvasResource(
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper)
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper)
: context_provider_wrapper_(std::move(context_provider_wrapper)) {}
CanvasResource::~CanvasResource() {
@@ -61,13 +61,14 @@
CanvasResource_Skia::CanvasResource_Skia(
sk_sp<SkImage> image,
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper)
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper)
: CanvasResource(std::move(context_provider_wrapper)),
image_(std::move(image)) {}
scoped_refptr<CanvasResource_Skia> CanvasResource_Skia::Create(
sk_sp<SkImage> image,
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper) {
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>
+ context_provider_wrapper) {
scoped_refptr<CanvasResource_Skia> resource =
AdoptRef(new CanvasResource_Skia(std::move(image),
std::move(context_provider_wrapper)));
@@ -109,7 +110,7 @@
CanvasResource_GpuMemoryBuffer::CanvasResource_GpuMemoryBuffer(
const IntSize& size,
const CanvasColorParams& color_params,
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper)
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper)
: CanvasResource(std::move(context_provider_wrapper)),
color_params_(color_params) {
if (!context_provider_wrapper_)
@@ -153,7 +154,8 @@
CanvasResource_GpuMemoryBuffer::Create(
const IntSize& size,
const CanvasColorParams& color_params,
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper) {
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>
+ context_provider_wrapper) {
scoped_refptr<CanvasResource_GpuMemoryBuffer> resource =
AdoptRef(new CanvasResource_GpuMemoryBuffer(size, color_params,
context_provider_wrapper));
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasResource.h b/third_party/WebKit/Source/platform/graphics/CanvasResource.h
index 1e4f5f0..ac5e7d96 100644
--- a/third_party/WebKit/Source/platform/graphics/CanvasResource.h
+++ b/third_party/WebKit/Source/platform/graphics/CanvasResource.h
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/memory/weak_ptr.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/common/sync_token.h"
@@ -37,12 +38,12 @@
void WaitSyncTokenBeforeRelease();
protected:
- CanvasResource(WeakPtr<WebGraphicsContext3DProviderWrapper>);
+ CanvasResource(base::WeakPtr<WebGraphicsContext3DProviderWrapper>);
gpu::Mailbox gpu_mailbox_;
// Sync token that was provided when resource was released
gpu::SyncToken sync_token_for_release_;
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
};
// Resource type for skia Bitmaps (RAM and texture backed)
@@ -50,7 +51,7 @@
public:
static scoped_refptr<CanvasResource_Skia> Create(
sk_sp<SkImage>,
- WeakPtr<WebGraphicsContext3DProviderWrapper>);
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>);
virtual ~CanvasResource_Skia() { Abandon(); }
// Not recyclable: Skia handles texture recycling internally and bitmaps are
@@ -62,7 +63,7 @@
private:
CanvasResource_Skia(sk_sp<SkImage>,
- WeakPtr<WebGraphicsContext3DProviderWrapper>);
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>);
sk_sp<SkImage> image_;
};
@@ -74,7 +75,7 @@
static scoped_refptr<CanvasResource_GpuMemoryBuffer> Create(
const IntSize&,
const CanvasColorParams&,
- WeakPtr<WebGraphicsContext3DProviderWrapper>);
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>);
virtual ~CanvasResource_GpuMemoryBuffer();
bool IsRecycleable() const final { return IsValid(); }
bool IsValid() const { return context_provider_wrapper_ && image_id_; }
@@ -82,9 +83,10 @@
GLuint TextureId() const final { return texture_id_; }
private:
- CanvasResource_GpuMemoryBuffer(const IntSize&,
- const CanvasColorParams&,
- WeakPtr<WebGraphicsContext3DProviderWrapper>);
+ CanvasResource_GpuMemoryBuffer(
+ const IntSize&,
+ const CanvasColorParams&,
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>);
std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_;
GLuint image_id_ = 0;
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasResourceProvider.cpp b/third_party/WebKit/Source/platform/graphics/CanvasResourceProvider.cpp
index 3135dcd..de9c7b1 100644
--- a/third_party/WebKit/Source/platform/graphics/CanvasResourceProvider.cpp
+++ b/third_party/WebKit/Source/platform/graphics/CanvasResourceProvider.cpp
@@ -35,7 +35,8 @@
const IntSize& size,
unsigned msaa_sample_count,
const CanvasColorParams color_params,
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper)
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>
+ context_provider_wrapper)
: CanvasResourceProvider(size,
color_params,
std::move(context_provider_wrapper)),
@@ -151,7 +152,8 @@
const IntSize& size,
unsigned msaa_sample_count,
const CanvasColorParams color_params,
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper)
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>
+ context_provider_wrapper)
: CanvasResourceProvider_Texture(size,
msaa_sample_count,
color_params,
@@ -277,7 +279,8 @@
unsigned msaa_sample_count,
const CanvasColorParams& colorParams,
ResourceUsage usage,
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper) {
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>
+ context_provider_wrapper) {
const ResourceType* resource_type_fallback_list = nullptr;
size_t list_length = 0;
@@ -343,7 +346,7 @@
CanvasResourceProvider::CanvasResourceProvider(
const IntSize& size,
const CanvasColorParams& color_params,
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper)
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper)
: weak_ptr_factory_(this),
context_provider_wrapper_(std::move(context_provider_wrapper)),
size_(size),
@@ -408,7 +411,7 @@
}
static void ReleaseFrameResources(
- WeakPtr<CanvasResourceProvider> resource_provider,
+ base::WeakPtr<CanvasResourceProvider> resource_provider,
scoped_refptr<CanvasResource> resource,
const gpu::SyncToken& sync_token,
bool lost_resource) {
@@ -454,9 +457,8 @@
DoPrepareTransferableResource(out_resource);
if (!resource)
return false;
- auto func =
- WTF::Bind(&ReleaseFrameResources, weak_ptr_factory_.CreateWeakPtr(),
- WTF::Passed(std::move(resource)));
+ auto func = WTF::Bind(&ReleaseFrameResources, weak_ptr_factory_.GetWeakPtr(),
+ WTF::Passed(std::move(resource)));
*out_callback = viz::SingleReleaseCallback::Create(
ConvertToBaseCallback(std::move(func)));
return true;
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasResourceProvider.h b/third_party/WebKit/Source/platform/graphics/CanvasResourceProvider.h
index 7ad9a1f..0ff5a42 100644
--- a/third_party/WebKit/Source/platform/graphics/CanvasResourceProvider.h
+++ b/third_party/WebKit/Source/platform/graphics/CanvasResourceProvider.h
@@ -6,12 +6,12 @@
#define CanvasResourceProvider_h
#include "base/memory/scoped_refptr.h"
+#include "base/memory/weak_ptr.h"
#include "platform/geometry/IntSize.h"
#include "platform/graphics/CanvasColorParams.h"
#include "platform/wtf/Noncopyable.h"
#include "platform/wtf/RefCounted.h"
#include "platform/wtf/Vector.h"
-#include "platform/wtf/WeakPtr.h"
#include "third_party/khronos/GLES2/gl2.h"
class GrContext;
@@ -75,7 +75,7 @@
unsigned msaa_sample_count,
const CanvasColorParams&,
ResourceUsage,
- WeakPtr<WebGraphicsContext3DProviderWrapper> = nullptr);
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> = nullptr);
cc::PaintCanvas* Canvas();
void FlushSkia() const;
@@ -100,7 +100,7 @@
protected:
gpu::gles2::GLES2Interface* ContextGL() const;
GrContext* GetGrContext() const;
- WeakPtr<WebGraphicsContext3DProviderWrapper> ContextProviderWrapper() {
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> ContextProviderWrapper() {
return context_provider_wrapper_;
}
GLenum GetGLFilter() const;
@@ -114,7 +114,7 @@
CanvasResourceProvider(const IntSize&,
const CanvasColorParams&,
- WeakPtr<WebGraphicsContext3DProviderWrapper>);
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>);
private:
virtual sk_sp<SkSurface> CreateSkSurface() const = 0;
@@ -122,8 +122,8 @@
virtual scoped_refptr<CanvasResource> DoPrepareTransferableResource(
viz::TransferableResource* out_resource) = 0;
- WeakPtrFactory<CanvasResourceProvider> weak_ptr_factory_;
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
+ base::WeakPtrFactory<CanvasResourceProvider> weak_ptr_factory_;
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
IntSize size_;
CanvasColorParams color_params_;
std::unique_ptr<cc::PaintCanvas> canvas_;
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasResourceTest.cpp b/third_party/WebKit/Source/platform/graphics/CanvasResourceTest.cpp
index 8cb5f55..47d6150e 100644
--- a/third_party/WebKit/Source/platform/graphics/CanvasResourceTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/CanvasResourceTest.cpp
@@ -47,7 +47,7 @@
protected:
MockGLES2InterfaceWithMailboxSupport gl_;
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
};
TEST_F(CanvasResourceTest, SkiaResourceNoMailboxLeak) {
diff --git a/third_party/WebKit/Source/platform/graphics/Image.h b/third_party/WebKit/Source/platform/graphics/Image.h
index 85bd860..ac07eb8f 100644
--- a/third_party/WebKit/Source/platform/graphics/Image.h
+++ b/third_party/WebKit/Source/platform/graphics/Image.h
@@ -28,6 +28,7 @@
#define Image_h
#include "base/memory/scoped_refptr.h"
+#include "base/memory/weak_ptr.h"
#include "platform/PlatformExport.h"
#include "platform/SharedBuffer.h"
#include "platform/geometry/IntRect.h"
@@ -41,7 +42,6 @@
#include "platform/wtf/Noncopyable.h"
#include "platform/wtf/ThreadSafeRefCounted.h"
#include "platform/wtf/Time.h"
-#include "platform/wtf/WeakPtr.h"
#include "third_party/skia/include/core/SkRefCnt.h"
class SkMatrix;
@@ -224,8 +224,8 @@
virtual WebGraphicsContext3DProvider* ContextProvider() const {
return nullptr;
}
- virtual WeakPtr<WebGraphicsContext3DProviderWrapper> ContextProviderWrapper()
- const {
+ virtual base::WeakPtr<WebGraphicsContext3DProviderWrapper>
+ ContextProviderWrapper() const {
return nullptr;
}
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.h b/third_party/WebKit/Source/platform/graphics/ImageBuffer.h
index 4a26bed..60749892 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.h
+++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.h
@@ -30,6 +30,7 @@
#include <memory>
#include "base/memory/scoped_refptr.h"
+#include "base/memory/weak_ptr.h"
#include "platform/PlatformExport.h"
#include "platform/geometry/FloatRect.h"
#include "platform/geometry/IntSize.h"
@@ -148,7 +149,7 @@
// have reference to Canvas2DLayerBridge. See crbug.com/776806.
void OnCanvasDisposed();
- WeakPtrFactory<ImageBuffer> weak_ptr_factory_;
+ base::WeakPtrFactory<ImageBuffer> weak_ptr_factory_;
protected:
ImageBuffer(std::unique_ptr<ImageBufferSurface>);
diff --git a/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.cpp b/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.cpp
index c6ea56db..82aa9fab 100644
--- a/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.cpp
+++ b/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.cpp
@@ -21,7 +21,7 @@
bool is_converted_from_skia_texture,
unsigned texture_id,
std::unique_ptr<gpu::Mailbox> mailbox,
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider,
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider,
std::unique_ptr<gpu::SyncToken> sync_token) {
if (!is_converted_from_skia_texture && texture_id && context_provider) {
context_provider->ContextProvider()->ContextGL()->WaitSyncTokenCHROMIUM(
@@ -37,7 +37,8 @@
const gpu::Mailbox& mailbox,
const gpu::SyncToken& sync_token,
unsigned texture_id_to_delete_after_mailbox_consumed,
- WeakPtr<WebGraphicsContext3DProviderWrapper>&& context_provider_wrapper,
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&
+ context_provider_wrapper,
IntSize mailbox_size)
: TextureHolder(std::move(context_provider_wrapper)),
mailbox_(mailbox),
diff --git a/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.h b/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.h
index 80a1841..b42c2615 100644
--- a/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.h
+++ b/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.h
@@ -5,12 +5,12 @@
#ifndef MailboxTextureHolder_h
#define MailboxTextureHolder_h
+#include "base/memory/weak_ptr.h"
#include "platform/PlatformExport.h"
#include "platform/WebTaskRunner.h"
#include "platform/graphics/GraphicsTypes.h"
#include "platform/graphics/TextureHolder.h"
#include "platform/graphics/WebGraphicsContext3DProviderWrapper.h"
-#include "platform/wtf/WeakPtr.h"
#include "third_party/khronos/GLES2/gl2.h"
namespace blink {
@@ -38,7 +38,7 @@
MailboxTextureHolder(const gpu::Mailbox&,
const gpu::SyncToken&,
unsigned texture_id_to_delete_after_mailbox_consumed,
- WeakPtr<WebGraphicsContext3DProviderWrapper>&&,
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&,
IntSize mailbox_size);
// This function turns a texture-backed SkImage into a mailbox and a
// syncToken.
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcher.h b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcher.h
index 81d438d..a612781 100644
--- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcher.h
+++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcher.h
@@ -6,10 +6,10 @@
#define OffscreenCanvasFrameDispatcher_h
#include "base/memory/scoped_refptr.h"
+#include "base/memory/weak_ptr.h"
#include "platform/PlatformExport.h"
#include "platform/WebTaskRunner.h"
#include "platform/geometry/IntRect.h"
-#include "platform/wtf/WeakPtr.h"
namespace blink {
@@ -34,8 +34,8 @@
virtual void Reshape(int width, int height) = 0;
- WeakPtr<OffscreenCanvasFrameDispatcher> CreateWeakPtr() {
- return weak_ptr_factory_.CreateWeakPtr();
+ base::WeakPtr<OffscreenCanvasFrameDispatcher> GetWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
}
OffscreenCanvasFrameDispatcherClient* Client() { return client_; }
@@ -45,7 +45,7 @@
: weak_ptr_factory_(this), client_(client) {}
private:
- WeakPtrFactory<OffscreenCanvasFrameDispatcher> weak_ptr_factory_;
+ base::WeakPtrFactory<OffscreenCanvasFrameDispatcher> weak_ptr_factory_;
OffscreenCanvasFrameDispatcherClient* client_;
};
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
index f9182f8e..574596a 100644
--- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
+++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
@@ -69,11 +69,12 @@
namespace {
-void UpdatePlaceholderImage(WeakPtr<OffscreenCanvasFrameDispatcher> dispatcher,
- scoped_refptr<WebTaskRunner> task_runner,
- int placeholder_canvas_id,
- scoped_refptr<blink::StaticBitmapImage> image,
- unsigned resource_id) {
+void UpdatePlaceholderImage(
+ base::WeakPtr<OffscreenCanvasFrameDispatcher> dispatcher,
+ scoped_refptr<WebTaskRunner> task_runner,
+ int placeholder_canvas_id,
+ scoped_refptr<blink::StaticBitmapImage> image,
+ unsigned resource_id) {
DCHECK(IsMainThread());
OffscreenCanvasPlaceholder* placeholder_canvas =
OffscreenCanvasPlaceholder::GetPlaceholderById(placeholder_canvas_id);
@@ -125,7 +126,7 @@
->Scheduler()
->CompositorTaskRunner()
->PostTask(BLINK_FROM_HERE,
- CrossThreadBind(UpdatePlaceholderImage, this->CreateWeakPtr(),
+ CrossThreadBind(UpdatePlaceholderImage, this->GetWeakPtr(),
WTF::Passed(std::move(dispatcher_task_runner)),
placeholder_canvas_id_, std::move(image),
resource_id));
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.cpp
index 6e62c38..d2d516d 100644
--- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.cpp
+++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.cpp
@@ -21,7 +21,7 @@
}
void releaseFrameToDispatcher(
- WeakPtr<blink::OffscreenCanvasFrameDispatcher> dispatcher,
+ base::WeakPtr<blink::OffscreenCanvasFrameDispatcher> dispatcher,
scoped_refptr<blink::Image> oldImage,
unsigned resourceId) {
oldImage = nullptr; // Needed to unref'ed on the right thread
@@ -31,7 +31,7 @@
}
void SetSuspendAnimation(
- WeakPtr<blink::OffscreenCanvasFrameDispatcher> dispatcher,
+ base::WeakPtr<blink::OffscreenCanvasFrameDispatcher> dispatcher,
bool suspend) {
if (dispatcher) {
dispatcher->SetSuspendAnimation(suspend);
@@ -71,7 +71,7 @@
void OffscreenCanvasPlaceholder::SetPlaceholderFrame(
scoped_refptr<StaticBitmapImage> new_frame,
- WeakPtr<OffscreenCanvasFrameDispatcher> dispatcher,
+ base::WeakPtr<OffscreenCanvasFrameDispatcher> dispatcher,
scoped_refptr<WebTaskRunner> task_runner,
unsigned resource_id) {
DCHECK(IsPlaceholderRegistered());
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.h b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.h
index ddc79ca..fbccca2 100644
--- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.h
+++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.h
@@ -7,8 +7,8 @@
#include <memory>
#include "base/memory/scoped_refptr.h"
+#include "base/memory/weak_ptr.h"
#include "platform/PlatformExport.h"
-#include "platform/wtf/WeakPtr.h"
namespace blink {
@@ -20,10 +20,11 @@
public:
~OffscreenCanvasPlaceholder();
- virtual void SetPlaceholderFrame(scoped_refptr<StaticBitmapImage>,
- WeakPtr<OffscreenCanvasFrameDispatcher>,
- scoped_refptr<WebTaskRunner>,
- unsigned resource_id);
+ virtual void SetPlaceholderFrame(
+ scoped_refptr<StaticBitmapImage>,
+ base::WeakPtr<OffscreenCanvasFrameDispatcher>,
+ scoped_refptr<WebTaskRunner>,
+ unsigned resource_id);
void ReleasePlaceholderFrame();
void SetSuspendOffscreenCanvasAnimation(bool);
@@ -45,7 +46,7 @@
bool PostSetSuspendAnimationToOffscreenCanvasThread(bool suspend);
scoped_refptr<StaticBitmapImage> placeholder_frame_;
- WeakPtr<OffscreenCanvasFrameDispatcher> frame_dispatcher_;
+ base::WeakPtr<OffscreenCanvasFrameDispatcher> frame_dispatcher_;
scoped_refptr<WebTaskRunner> frame_dispatcher_task_runner_;
unsigned placeholder_frame_resource_id_ = 0;
diff --git a/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.cpp b/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.cpp
index ef2e1c4..384d868a 100644
--- a/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.cpp
+++ b/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.cpp
@@ -17,7 +17,8 @@
SkiaTextureHolder::SkiaTextureHolder(
sk_sp<SkImage> image,
- WeakPtr<WebGraphicsContext3DProviderWrapper>&& context_provider_wrapper)
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&
+ context_provider_wrapper)
: TextureHolder(std::move(context_provider_wrapper)),
image_(std::move(image)) {}
diff --git a/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h b/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h
index 943c37d..95ffdde 100644
--- a/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h
+++ b/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h
@@ -5,6 +5,7 @@
#ifndef SkiaTextureHolder_h
#define SkiaTextureHolder_h
+#include "base/memory/weak_ptr.h"
#include "platform/PlatformExport.h"
#include "platform/graphics/TextureHolder.h"
@@ -32,7 +33,7 @@
// When creating a AcceleratedStaticBitmap from a texture-backed SkImage, this
// function will be called to create a TextureHolder object.
SkiaTextureHolder(sk_sp<SkImage>,
- WeakPtr<WebGraphicsContext3DProviderWrapper>&&);
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&);
// This function consumes the mailbox in the input parameter and turn it into
// a texture-backed SkImage.
SkiaTextureHolder(std::unique_ptr<TextureHolder>);
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
index 7ba4e2d..2c5b3c8 100644
--- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
+++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
@@ -17,7 +17,8 @@
scoped_refptr<StaticBitmapImage> StaticBitmapImage::Create(
sk_sp<SkImage> image,
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper) {
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper>
+ context_provider_wrapper) {
if (image->isTextureBacked()) {
CHECK(context_provider_wrapper);
return AcceleratedStaticBitmapImage::CreateFromSkImage(
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h
index 4e1c7d5..867e241 100644
--- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h
+++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h
@@ -5,11 +5,11 @@
#ifndef StaticBitmapImage_h
#define StaticBitmapImage_h
+#include "base/memory/weak_ptr.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "platform/graphics/GraphicsTypes.h"
#include "platform/graphics/Image.h"
-#include "platform/wtf/WeakPtr.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/skia/include/core/SkRefCnt.h"
@@ -26,18 +26,18 @@
// associated.
static scoped_refptr<StaticBitmapImage> Create(
sk_sp<SkImage>,
- WeakPtr<WebGraphicsContext3DProviderWrapper> = nullptr);
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> = nullptr);
static scoped_refptr<StaticBitmapImage> Create(PaintImage);
bool IsStaticBitmapImage() const override { return true; }
// Methods overridden by all sub-classes
- virtual ~StaticBitmapImage() {}
+ virtual ~StaticBitmapImage() = default;
// Creates a gpu copy of the image using the given ContextProvider. Should
// not be called if IsTextureBacked() is already true. May return null if the
// conversion failed (for instance if the context had an error).
virtual scoped_refptr<StaticBitmapImage> MakeAccelerated(
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_wrapper) = 0;
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_wrapper) = 0;
// Methods have common implementation for all sub-classes
bool CurrentFrameIsComplete() override { return true; }
diff --git a/third_party/WebKit/Source/platform/graphics/TextureHolder.h b/third_party/WebKit/Source/platform/graphics/TextureHolder.h
index b9bf88e..74a9c57 100644
--- a/third_party/WebKit/Source/platform/graphics/TextureHolder.h
+++ b/third_party/WebKit/Source/platform/graphics/TextureHolder.h
@@ -5,6 +5,7 @@
#ifndef TextureHolder_h
#define TextureHolder_h
+#include "base/memory/weak_ptr.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "platform/PlatformExport.h"
@@ -47,7 +48,8 @@
virtual void Abandon() { is_abandoned_ = true; } // Overrides must call base.
// Methods that have exactly the same impelmentation for all sub-classes
- WeakPtr<WebGraphicsContext3DProviderWrapper> ContextProviderWrapper() const {
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> ContextProviderWrapper()
+ const {
return context_provider_wrapper_;
}
@@ -59,8 +61,8 @@
bool IsAbandoned() const { return is_abandoned_; }
protected:
- TextureHolder(
- WeakPtr<WebGraphicsContext3DProviderWrapper>&& context_provider_wrapper)
+ TextureHolder(base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&
+ context_provider_wrapper)
: context_provider_wrapper_(std::move(context_provider_wrapper)) {}
private:
@@ -69,7 +71,7 @@
// another thread, and the original thread gone out of scope, and that we need
// to clear the resouces associated with that AcceleratedStaticBitmapImage on
// the original thread.
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
bool is_abandoned_ = false;
};
diff --git a/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp
index 1e035ae..23819b1 100644
--- a/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp
+++ b/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp
@@ -49,7 +49,7 @@
scoped_refptr<StaticBitmapImage>
UnacceleratedStaticBitmapImage::MakeAccelerated(
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_wrapper) {
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_wrapper) {
if (!context_wrapper)
return nullptr; // Can happen if the context is lost.
diff --git a/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.h b/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.h
index 419edf2..4f0cb8b 100644
--- a/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.h
+++ b/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.h
@@ -5,6 +5,7 @@
#ifndef UnacceleratedStaticBitmapImage_h
#define UnacceleratedStaticBitmapImage_h
+#include "base/memory/weak_ptr.h"
#include "platform/graphics/StaticBitmapImage.h"
namespace blink {
@@ -20,7 +21,8 @@
IntSize Size() const override;
bool IsPremultiplied() const override;
scoped_refptr<StaticBitmapImage> MakeAccelerated(
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_wrapper) override;
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_wrapper)
+ override;
void Draw(PaintCanvas*,
const PaintFlags&,
diff --git a/third_party/WebKit/Source/platform/graphics/VideoFrameResourceProvider.cpp b/third_party/WebKit/Source/platform/graphics/VideoFrameResourceProvider.cpp
index 0bc3280..55c66f07 100644
--- a/third_party/WebKit/Source/platform/graphics/VideoFrameResourceProvider.cpp
+++ b/third_party/WebKit/Source/platform/graphics/VideoFrameResourceProvider.cpp
@@ -14,7 +14,6 @@
#include "components/viz/common/quads/texture_draw_quad.h"
#include "components/viz/common/quads/yuv_video_draw_quad.h"
#include "media/base/video_frame.h"
-#include "platform/wtf/WeakPtr.h"
namespace cc {
class VideoFrameExternalResources;
diff --git a/third_party/WebKit/Source/platform/graphics/VideoFrameResourceProvider.h b/third_party/WebKit/Source/platform/graphics/VideoFrameResourceProvider.h
index a0e58b3..99d9c6e 100644
--- a/third_party/WebKit/Source/platform/graphics/VideoFrameResourceProvider.h
+++ b/third_party/WebKit/Source/platform/graphics/VideoFrameResourceProvider.h
@@ -5,6 +5,7 @@
#ifndef VideoFrameResourceProvider_h
#define VideoFrameResourceProvider_h
+#include "base/memory/weak_ptr.h"
#include "cc/resources/layer_tree_resource_provider.h"
#include "cc/resources/video_resource_updater.h"
#include "cc/trees/layer_tree_settings.h"
diff --git a/third_party/WebKit/Source/platform/graphics/VideoFrameSubmitter.h b/third_party/WebKit/Source/platform/graphics/VideoFrameSubmitter.h
index 43afe57..5ad6d14 100644
--- a/third_party/WebKit/Source/platform/graphics/VideoFrameSubmitter.h
+++ b/third_party/WebKit/Source/platform/graphics/VideoFrameSubmitter.h
@@ -5,6 +5,7 @@
#ifndef VideoFrameSubmitter_h
#define VideoFrameSubmitter_h
+#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "components/viz/common/surfaces/local_surface_id_allocator.h"
#include "mojo/public/cpp/bindings/binding.h"
diff --git a/third_party/WebKit/Source/platform/graphics/WebGraphicsContext3DProviderWrapper.h b/third_party/WebKit/Source/platform/graphics/WebGraphicsContext3DProviderWrapper.h
index a5acbec..63d2936 100644
--- a/third_party/WebKit/Source/platform/graphics/WebGraphicsContext3DProviderWrapper.h
+++ b/third_party/WebKit/Source/platform/graphics/WebGraphicsContext3DProviderWrapper.h
@@ -5,9 +5,9 @@
#ifndef WebGraphicsContext3DProviderWrapper_h
#define WebGraphicsContext3DProviderWrapper_h
+#include "base/memory/weak_ptr.h"
#include "platform/PlatformExport.h"
#include "platform/graphics/gpu/GraphicsContext3DUtils.h"
-#include "platform/wtf/WeakPtr.h"
#include "public/platform/WebGraphicsContext3DProvider.h"
namespace blink {
@@ -18,10 +18,10 @@
std::unique_ptr<WebGraphicsContext3DProvider> provider)
: context_provider_(std::move(provider)), weak_ptr_factory_(this) {
DCHECK(context_provider_);
- utils_ = WTF::WrapUnique(new GraphicsContext3DUtils(CreateWeakPtr()));
+ utils_ = WTF::WrapUnique(new GraphicsContext3DUtils(GetWeakPtr()));
}
- WeakPtr<WebGraphicsContext3DProviderWrapper> CreateWeakPtr() {
- return weak_ptr_factory_.CreateWeakPtr();
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> GetWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
}
WebGraphicsContext3DProvider* ContextProvider() {
return context_provider_.get();
@@ -32,7 +32,7 @@
private:
std::unique_ptr<GraphicsContext3DUtils> utils_;
std::unique_ptr<WebGraphicsContext3DProvider> context_provider_;
- WeakPtrFactory<WebGraphicsContext3DProviderWrapper> weak_ptr_factory_;
+ base::WeakPtrFactory<WebGraphicsContext3DProviderWrapper> weak_ptr_factory_;
};
} // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp
index 001536e..7030c8c 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp
@@ -84,7 +84,7 @@
return nullptr;
// Must make a copy of the WeakPtr because CreateFromSkImage only takes
// r-value references.
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper =
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper =
context_provider_wrapper_;
scoped_refptr<AcceleratedStaticBitmapImage> image =
AcceleratedStaticBitmapImage::CreateFromSkImage(
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h
index fa2c3ea..e2dd600 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h
+++ b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h
@@ -32,9 +32,9 @@
#define AcceleratedImageBufferSurface_h
#include <memory>
+#include "base/memory/weak_ptr.h"
#include "platform/graphics/ImageBufferSurface.h"
#include "platform/graphics/paint/PaintCanvas.h"
-#include "platform/wtf/WeakPtr.h"
#include "public/platform/WebGraphicsContext3DProvider.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkSurface.h"
@@ -66,7 +66,7 @@
int y) override;
private:
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
sk_sp<SkSurface> surface_;
std::unique_ptr<PaintCanvas> canvas_;
};
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
index 1a040baf..8bbae7c 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -541,7 +541,7 @@
// in DrawingBuffer.
return AcceleratedStaticBitmapImage::CreateFromWebGLContextImage(
sk_image_mailbox, sk_image_sync_token, texture_id,
- context_provider_->CreateWeakPtr(), size_);
+ context_provider_->GetWeakPtr(), size_);
}
scoped_refptr<DrawingBuffer::ColorBuffer> DrawingBuffer::CreateOrRecycleColorBuffer() {
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.cpp b/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.cpp
index c3f430d..1c567d44 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.cpp
@@ -14,7 +14,8 @@
struct GrTextureMailboxReleaseProcData {
GrTexture* gr_texture_;
- WeakPtr<blink::WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
+ base::WeakPtr<blink::WebGraphicsContext3DProviderWrapper>
+ context_provider_wrapper_;
};
void GrTextureMailboxReleaseProc(void* data) {
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.h b/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.h
index bfb3039..82d03d7 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.h
+++ b/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.h
@@ -5,11 +5,11 @@
#ifndef GraphicsContext3DUtils_h
#define GraphicsContext3DUtils_h
+#include "base/memory/weak_ptr.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "platform/PlatformExport.h"
#include "platform/wtf/HashMap.h"
-#include "platform/wtf/WeakPtr.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/gpu/GrTexture.h"
@@ -21,8 +21,8 @@
public:
// The constructor takes a weak ref to the wrapper because it internally
// it generates callbacks that may outlive the wrapper.
- GraphicsContext3DUtils(
- WeakPtr<WebGraphicsContext3DProviderWrapper>&& context_provider_wrapper)
+ GraphicsContext3DUtils(base::WeakPtr<WebGraphicsContext3DProviderWrapper>&&
+ context_provider_wrapper)
: context_provider_wrapper_(std::move(context_provider_wrapper)) {}
// Use this service to create a new mailbox or possibly obtain a pre-existing
@@ -33,7 +33,7 @@
void RemoveCachedMailbox(GrTexture*);
private:
- WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_;
WTF::HashMap<GrTexture*, gpu::Mailbox> cached_mailboxes_;
};
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.cpp b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.cpp
index cc9585e..0c3a463 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.cpp
@@ -36,14 +36,14 @@
return !this_ptr->is_gpu_compositing_disabled_;
}
-WeakPtr<WebGraphicsContext3DProviderWrapper>
+base::WeakPtr<WebGraphicsContext3DProviderWrapper>
SharedGpuContext::ContextProviderWrapper() {
SharedGpuContext* this_ptr = GetInstanceForCurrentThread();
bool only_if_gpu_compositing = false;
this_ptr->CreateContextProviderIfNeeded(only_if_gpu_compositing);
if (!this_ptr->context_provider_wrapper_)
return nullptr;
- return this_ptr->context_provider_wrapper_->CreateWeakPtr();
+ return this_ptr->context_provider_wrapper_->GetWeakPtr();
}
static void CreateContextProviderOnMainThread(
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h
index 0975b5f..b9030ed 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h
+++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h
@@ -5,6 +5,7 @@
#ifndef SharedGpuContext_h
#define SharedGpuContext_h
+#include "base/memory/weak_ptr.h"
#include "platform/PlatformExport.h"
#include "platform/graphics/WebGraphicsContext3DProviderWrapper.h"
#include "platform/wtf/Functional.h"
@@ -30,7 +31,8 @@
// instead.
static bool IsGpuCompositingEnabled();
// May re-create context if context was lost
- static WeakPtr<WebGraphicsContext3DProviderWrapper> ContextProviderWrapper();
+ static base::WeakPtr<WebGraphicsContext3DProviderWrapper>
+ ContextProviderWrapper();
static bool AllowSoftwareToAcceleratedCanvasUpgrade();
static bool IsValidWithoutRestoring();
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp
index 4706492..59285f65 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp
@@ -92,7 +92,7 @@
TEST_F(SharedGpuContextTest, contextLossAutoRecovery) {
EXPECT_NE(SharedGpuContext::ContextProviderWrapper(), nullptr);
- WeakPtr<WebGraphicsContext3DProviderWrapper> context =
+ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context =
SharedGpuContext::ContextProviderWrapper();
gl_.SetIsContextLost(true);
EXPECT_FALSE(SharedGpuContext::IsValidWithoutRestoring());
diff --git a/third_party/WebKit/Source/platform/wtf/BUILD.gn b/third_party/WebKit/Source/platform/wtf/BUILD.gn
index 6c2c5fe1..dde0d91c 100644
--- a/third_party/WebKit/Source/platform/wtf/BUILD.gn
+++ b/third_party/WebKit/Source/platform/wtf/BUILD.gn
@@ -137,7 +137,6 @@
"WTFExport.h",
"WTFThreadData.cpp",
"WTFThreadData.h",
- "WeakPtr.h",
"allocator/PartitionAllocator.cpp",
"allocator/PartitionAllocator.h",
"allocator/Partitions.cpp",
diff --git a/third_party/WebKit/Source/platform/wtf/FunctionalTest.cpp b/third_party/WebKit/Source/platform/wtf/FunctionalTest.cpp
index 7a7b417d..fb0ec6c 100644
--- a/third_party/WebKit/Source/platform/wtf/FunctionalTest.cpp
+++ b/third_party/WebKit/Source/platform/wtf/FunctionalTest.cpp
@@ -27,12 +27,13 @@
#include <memory>
#include <utility>
+
+#include "base/memory/weak_ptr.h"
#include "base/test/gtest_util.h"
#include "base/threading/thread.h"
#include "platform/wtf/LeakAnnotations.h"
#include "platform/wtf/RefCounted.h"
#include "platform/wtf/WTFTestHelper.h"
-#include "platform/wtf/WeakPtr.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace WTF {
@@ -51,16 +52,16 @@
public:
HasWeakPtrSupport() : weak_ptr_factory_(this) {}
- WTF::WeakPtr<HasWeakPtrSupport> CreateWeakPtr() {
- return weak_ptr_factory_.CreateWeakPtr();
+ base::WeakPtr<HasWeakPtrSupport> GetWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
}
- void RevokeAll() { weak_ptr_factory_.RevokeAll(); }
+ void RevokeAll() { weak_ptr_factory_.InvalidateWeakPtrs(); }
void Increment(int* counter) { ++*counter; }
private:
- WTF::WeakPtrFactory<HasWeakPtrSupport> weak_ptr_factory_;
+ base::WeakPtrFactory<HasWeakPtrSupport> weak_ptr_factory_;
};
} // namespace WTF
@@ -138,7 +139,7 @@
HasWeakPtrSupport obj;
int counter = 0;
WTF::RepeatingClosure bound =
- WTF::BindRepeating(&HasWeakPtrSupport::Increment, obj.CreateWeakPtr(),
+ WTF::BindRepeating(&HasWeakPtrSupport::Increment, obj.GetWeakPtr(),
WTF::Unretained(&counter));
bound.Run();
diff --git a/third_party/WebKit/Source/platform/wtf/WeakPtr.h b/third_party/WebKit/Source/platform/wtf/WeakPtr.h
deleted file mode 100644
index 300f118..0000000
--- a/third_party/WebKit/Source/platform/wtf/WeakPtr.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2013 Google, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WTF_WeakPtr_h
-#define WTF_WeakPtr_h
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "platform/wtf/Allocator.h"
-
-namespace WTF {
-
-template <typename T>
-using WeakPtr = base::WeakPtr<T>;
-
-template <typename T>
-class WeakPtrFactory {
- USING_FAST_MALLOC(WeakPtrFactory);
-
- public:
- explicit WeakPtrFactory(T* ptr) : factory_(ptr) {}
-
- WeakPtr<T> CreateWeakPtr() { return factory_.GetWeakPtr(); }
-
- void RevokeAll() { factory_.InvalidateWeakPtrs(); }
-
- bool HasWeakPtrs() const { return factory_.HasWeakPtrs(); }
-
- private:
- base::WeakPtrFactory<T> factory_;
-
- DISALLOW_COPY_AND_ASSIGN(WeakPtrFactory<T>);
-};
-
-} // namespace WTF
-
-using WTF::WeakPtr;
-using WTF::WeakPtrFactory;
-
-#endif