Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: ppapi/shared_impl/proxy_lock.h

Issue 1864293002: Convert //ppapi to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/shared_impl/proxy_lock.h
diff --git a/ppapi/shared_impl/proxy_lock.h b/ppapi/shared_impl/proxy_lock.h
index 8c7bc837435bc241d135ded4d7bef5206a605dce..366504eeb9a7dde3b95c5edae90c248c919868f6 100644
--- a/ppapi/shared_impl/proxy_lock.h
+++ b/ppapi/shared_impl/proxy_lock.h
@@ -5,12 +5,12 @@
#ifndef PPAPI_SHARED_IMPL_PROXY_LOCK_H_
#define PPAPI_SHARED_IMPL_PROXY_LOCK_H_
+#include <memory>
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
@@ -185,7 +185,7 @@ class RunWhileLockedHelper<void()> {
// creation.
thread_checker_.DetachFromThread();
}
- static void CallWhileLocked(scoped_ptr<RunWhileLockedHelper> ptr) {
+ static void CallWhileLocked(std::unique_ptr<RunWhileLockedHelper> ptr) {
// Bind thread_checker_ to this thread so we can check in the destructor.
// *If* the callback gets invoked, it's important that RunWhileLockedHelper
// is destroyed on the same thread (see the comments in the destructor).
@@ -195,7 +195,7 @@ class RunWhileLockedHelper<void()> {
// Use a scope and local Callback to ensure that the callback is cleared
// before the lock is released, even in the unlikely event that Run()
// throws an exception.
- scoped_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
+ std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
temp_callback->Run();
}
}
@@ -228,7 +228,7 @@ class RunWhileLockedHelper<void()> {
private:
DISALLOW_COPY_AND_ASSIGN(RunWhileLockedHelper);
- scoped_ptr<CallbackType> callback_;
+ std::unique_ptr<CallbackType> callback_;
// Used to ensure that the Callback is run and deleted on the same thread.
base::ThreadChecker thread_checker_;
@@ -242,11 +242,12 @@ class RunWhileLockedHelper<void(P1)> {
: callback_(new CallbackType(callback)) {
thread_checker_.DetachFromThread();
}
- static void CallWhileLocked(scoped_ptr<RunWhileLockedHelper> ptr, P1 p1) {
+ static void CallWhileLocked(std::unique_ptr<RunWhileLockedHelper> ptr,
+ P1 p1) {
DCHECK(ptr->thread_checker_.CalledOnValidThread());
ProxyAutoLock lock;
{
- scoped_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
+ std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
temp_callback->Run(p1);
}
}
@@ -260,7 +261,7 @@ class RunWhileLockedHelper<void(P1)> {
private:
DISALLOW_COPY_AND_ASSIGN(RunWhileLockedHelper);
- scoped_ptr<CallbackType> callback_;
+ std::unique_ptr<CallbackType> callback_;
base::ThreadChecker thread_checker_;
};
@@ -272,12 +273,13 @@ class RunWhileLockedHelper<void(P1, P2)> {
: callback_(new CallbackType(callback)) {
thread_checker_.DetachFromThread();
}
- static void CallWhileLocked(
- scoped_ptr<RunWhileLockedHelper> ptr, P1 p1, P2 p2) {
+ static void CallWhileLocked(std::unique_ptr<RunWhileLockedHelper> ptr,
+ P1 p1,
+ P2 p2) {
DCHECK(ptr->thread_checker_.CalledOnValidThread());
ProxyAutoLock lock;
{
- scoped_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
+ std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
temp_callback->Run(p1, p2);
}
}
@@ -291,7 +293,7 @@ class RunWhileLockedHelper<void(P1, P2)> {
private:
DISALLOW_COPY_AND_ASSIGN(RunWhileLockedHelper);
- scoped_ptr<CallbackType> callback_;
+ std::unique_ptr<CallbackType> callback_;
base::ThreadChecker thread_checker_;
};
@@ -303,12 +305,14 @@ class RunWhileLockedHelper<void(P1, P2, P3)> {
: callback_(new CallbackType(callback)) {
thread_checker_.DetachFromThread();
}
- static void CallWhileLocked(
- scoped_ptr<RunWhileLockedHelper> ptr, P1 p1, P2 p2, P3 p3) {
+ static void CallWhileLocked(std::unique_ptr<RunWhileLockedHelper> ptr,
+ P1 p1,
+ P2 p2,
+ P3 p3) {
DCHECK(ptr->thread_checker_.CalledOnValidThread());
ProxyAutoLock lock;
{
- scoped_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
+ std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
temp_callback->Run(p1, p2, p3);
}
}
@@ -322,7 +326,7 @@ class RunWhileLockedHelper<void(P1, P2, P3)> {
private:
DISALLOW_COPY_AND_ASSIGN(RunWhileLockedHelper);
- scoped_ptr<CallbackType> callback_;
+ std::unique_ptr<CallbackType> callback_;
base::ThreadChecker thread_checker_;
};
@@ -374,7 +378,7 @@ inline base::Callback<FunctionType> RunWhileLocked(
// in that case, if we used base::Owned, we might delete RunWhileLockedHelper
// on this thread, which will violate the RunWhileLockedHelper's assumption
// that it is destroyed on the same thread where it is run.
- scoped_ptr<internal::RunWhileLockedHelper<FunctionType>> helper(
+ std::unique_ptr<internal::RunWhileLockedHelper<FunctionType>> helper(
new internal::RunWhileLockedHelper<FunctionType>(callback));
return base::Bind(
&internal::RunWhileLockedHelper<FunctionType>::CallWhileLocked,

Powered by Google App Engine
This is Rietveld 408576698