summaryrefslogtreecommitdiffstats
path: root/cc/test/test_shared_bitmap_manager.cc
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2014-09-27 14:55:48 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-27 21:56:07 +0000
commitf446a070a0aa29a153b0cf78b33ef22da84cb023 (patch)
tree58723080156284eca6c914ec067cbf93afac948b /cc/test/test_shared_bitmap_manager.cc
parentea60a8e76d887c6b22acc495e5ea3c28540ae2ef (diff)
downloadchromium_src-f446a070a0aa29a153b0cf78b33ef22da84cb023.zip
chromium_src-f446a070a0aa29a153b0cf78b33ef22da84cb023.tar.gz
chromium_src-f446a070a0aa29a153b0cf78b33ef22da84cb023.tar.bz2
cc: Remove use of PassAs() and constructor-casting with scoped_ptr.
Say you have class A and subclass B. Previously it was required to PassAs() a scoped_ptr<B> into a scoped_ptr<A>. This is no longer needed, so just use Pass(). For newly created scoped_ptrs, you can just use make_scoped_ptr always now. And when you want to return or assign an empty scoped_ptr(), you can now use nullptr directly. Also adds PRESUBMIT checks for: - return scoped<T>(foo). This should be return make_scoped_ptr(foo). - bar = scoped<T>(foo). This should be return bar = make_scoped_ptr(foo). - return scoped<T>(). This should be return nullptr. - bar = scoped<T>(). This should be return bar = nullptr. This also replaces p.reset() with p = nullptr; But it does not add a PRESUBMIT check for that because there are things other than scoped_ptr with a reset() function. R=enne@chromium.org Committed: https://crrev.com/7bb3dbede19d87f0338797756ffd738adc6bca08 Cr-Commit-Position: refs/heads/master@{#297096} Review URL: https://codereview.chromium.org/609663003 Cr-Commit-Position: refs/heads/master@{#297121}
Diffstat (limited to 'cc/test/test_shared_bitmap_manager.cc')
-rw-r--r--cc/test/test_shared_bitmap_manager.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/cc/test/test_shared_bitmap_manager.cc b/cc/test/test_shared_bitmap_manager.cc
index e985572..d7716dd 100644
--- a/cc/test/test_shared_bitmap_manager.cc
+++ b/cc/test/test_shared_bitmap_manager.cc
@@ -25,7 +25,7 @@ scoped_ptr<SharedBitmap> TestSharedBitmapManager::AllocateSharedBitmap(
memory->CreateAndMapAnonymous(size.GetArea() * 4);
SharedBitmapId id = SharedBitmap::GenerateId();
bitmap_map_[id] = memory.get();
- return scoped_ptr<SharedBitmap>(
+ return make_scoped_ptr(
new SharedBitmap(memory.release(), id, base::Bind(&FreeSharedBitmap)));
}
@@ -34,8 +34,8 @@ scoped_ptr<SharedBitmap> TestSharedBitmapManager::GetSharedBitmapFromId(
const SharedBitmapId& id) {
base::AutoLock lock(lock_);
if (bitmap_map_.find(id) == bitmap_map_.end())
- return scoped_ptr<SharedBitmap>();
- return scoped_ptr<SharedBitmap>(
+ return nullptr;
+ return make_scoped_ptr(
new SharedBitmap(bitmap_map_[id], id, base::Bind(&IgnoreSharedBitmap)));
}
@@ -44,7 +44,7 @@ scoped_ptr<SharedBitmap> TestSharedBitmapManager::GetBitmapForSharedMemory(
base::AutoLock lock(lock_);
SharedBitmapId id = SharedBitmap::GenerateId();
bitmap_map_[id] = memory;
- return scoped_ptr<SharedBitmap>(
+ return make_scoped_ptr(
new SharedBitmap(memory, id, base::Bind(&IgnoreSharedBitmap)));
}