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

Unified Diff: cc/resources/video_resource_updater.cc

Issue 2838713004: Replace SupportsWeakPtr with WeakPtrFactory in VideoResourceUpdater (Closed)
Patch Set: Created 3 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
« no previous file with comments | « cc/resources/video_resource_updater.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/video_resource_updater.cc
diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc
index 33c818c7bd9edb7c0cb8e0557c76fe3788f5934d..62007f91c67aaa10b4ddf5d2bebebce20698819c 100644
--- a/cc/resources/video_resource_updater.cc
+++ b/cc/resources/video_resource_updater.cc
@@ -178,7 +178,8 @@ VideoResourceUpdater::VideoResourceUpdater(ContextProvider* context_provider,
bool use_stream_video_draw_quad)
: context_provider_(context_provider),
resource_provider_(resource_provider),
- use_stream_video_draw_quad_(use_stream_video_draw_quad) {}
+ use_stream_video_draw_quad_(use_stream_video_draw_quad),
+ weak_ptr_factory_(this) {}
VideoResourceUpdater::~VideoResourceUpdater() {
for (const PlaneResource& plane_resource : all_resources_)
@@ -421,8 +422,9 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
if (software_compositor) {
external_resources.software_resources.push_back(
plane_resource.resource_id());
- external_resources.software_release_callback = base::Bind(
- &RecycleResource, AsWeakPtr(), plane_resource.resource_id());
+ external_resources.software_release_callback =
+ base::Bind(&RecycleResource, weak_ptr_factory_.GetWeakPtr(),
+ plane_resource.resource_id());
external_resources.type = VideoFrameExternalResources::SOFTWARE_RESOURCE;
} else {
// VideoResourceUpdater shares a context with the compositor so
@@ -432,8 +434,9 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
plane_resource.resource_id()));
mailbox.set_color_space(output_color_space);
external_resources.mailboxes.push_back(mailbox);
- external_resources.release_callbacks.push_back(base::Bind(
- &RecycleResource, AsWeakPtr(), plane_resource.resource_id()));
+ external_resources.release_callbacks.push_back(
+ base::Bind(&RecycleResource, weak_ptr_factory_.GetWeakPtr(),
+ plane_resource.resource_id()));
external_resources.type = VideoFrameExternalResources::RGBA_RESOURCE;
}
return external_resources;
@@ -535,8 +538,9 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
plane_resource.resource_id()));
mailbox.set_color_space(output_color_space);
external_resources.mailboxes.push_back(mailbox);
- external_resources.release_callbacks.push_back(base::Bind(
- &RecycleResource, AsWeakPtr(), plane_resource.resource_id()));
+ external_resources.release_callbacks.push_back(
+ base::Bind(&RecycleResource, weak_ptr_factory_.GetWeakPtr(),
+ plane_resource.resource_id()));
}
external_resources.type = VideoFrameExternalResources::YUV_RESOURCE;
@@ -612,7 +616,8 @@ void VideoResourceUpdater::CopyPlaneTexture(
external_resources->mailboxes.push_back(mailbox);
external_resources->release_callbacks.push_back(
- base::Bind(&RecycleResource, AsWeakPtr(), resource->resource_id()));
+ base::Bind(&RecycleResource, weak_ptr_factory_.GetWeakPtr(),
+ resource->resource_id()));
}
VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes(
@@ -664,8 +669,8 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes(
media::VideoFrameMetadata::WANTS_PROMOTION_HINT));
#endif
external_resources.mailboxes.push_back(mailbox);
- external_resources.release_callbacks.push_back(
- base::Bind(&ReturnTexture, AsWeakPtr(), video_frame));
+ external_resources.release_callbacks.push_back(base::Bind(
+ &ReturnTexture, weak_ptr_factory_.GetWeakPtr(), video_frame));
}
}
return external_resources;
« no previous file with comments | « cc/resources/video_resource_updater.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698