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

Unified Diff: content/browser/compositor/delegated_frame_host.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 years, 1 month 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 | « content/browser/compositor/delegated_frame_host.h ('k') | content/browser/compositor/owned_mailbox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/delegated_frame_host.cc
diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc
index 0fb665771107286d2e7998bd7ea91318b81ba0e5..293f96f96be8021d3bd017d12f94fbbb387c9326 100644
--- a/content/browser/compositor/delegated_frame_host.cc
+++ b/content/browser/compositor/delegated_frame_host.cc
@@ -300,10 +300,9 @@ void DelegatedFrameHost::DidReceiveFrameFromRenderer(
request->set_source(frame_subscriber());
request->set_area(gfx::Rect(current_frame_size_in_dip_));
if (subscriber_texture.get()) {
- request->SetTextureMailbox(
- cc::TextureMailbox(subscriber_texture->mailbox(),
- subscriber_texture->target(),
- subscriber_texture->sync_point()));
+ request->SetTextureMailbox(cc::TextureMailbox(
+ subscriber_texture->mailbox(), subscriber_texture->sync_token(),
+ subscriber_texture->target()));
}
RequestCopyOfOutput(request.Pass());
}
@@ -591,14 +590,14 @@ static void CopyFromCompositingSurfaceFinished(
bool result) {
bitmap_pixels_lock.reset();
- uint32 sync_point = 0;
+ gpu::SyncToken sync_token;
if (result) {
GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
if (gl_helper)
- sync_point = gl_helper->InsertSyncPoint();
+ sync_token = gpu::SyncToken(gl_helper->InsertSyncPoint());
}
- bool lost_resource = sync_point == 0;
- release_callback->Run(sync_point, lost_resource);
+ const bool lost_resource = !sync_token.HasData();
+ release_callback->Run(sync_token, lost_resource);
callback.Run(*bitmap,
result ? content::READBACK_SUCCESS : content::READBACK_FAILED);
@@ -643,17 +642,10 @@ void DelegatedFrameHost::PrepareTextureCopyOutputResult(
ignore_result(scoped_callback_runner.Release());
gl_helper->CropScaleReadbackAndCleanMailbox(
- texture_mailbox.mailbox(),
- texture_mailbox.sync_point(),
- result->size(),
- gfx::Rect(result->size()),
- dst_size_in_pixel,
- pixels,
- color_type,
- base::Bind(&CopyFromCompositingSurfaceFinished,
- callback,
- base::Passed(&release_callback),
- base::Passed(&bitmap),
+ texture_mailbox.mailbox(), texture_mailbox.sync_token(), result->size(),
+ gfx::Rect(result->size()), dst_size_in_pixel, pixels, color_type,
+ base::Bind(&CopyFromCompositingSurfaceFinished, callback,
+ base::Passed(&release_callback), base::Passed(&bitmap),
base::Passed(&bitmap_pixels_lock)),
GLHelper::SCALER_QUALITY_GOOD);
}
@@ -713,13 +705,13 @@ void DelegatedFrameHost::PrepareBitmapCopyOutputResult(
void DelegatedFrameHost::ReturnSubscriberTexture(
base::WeakPtr<DelegatedFrameHost> dfh,
scoped_refptr<OwnedMailbox> subscriber_texture,
- uint32 sync_point) {
+ const gpu::SyncToken& sync_token) {
if (!subscriber_texture.get())
return;
if (!dfh)
return;
- subscriber_texture->UpdateSyncPoint(sync_point);
+ subscriber_texture->UpdateSyncToken(sync_token);
if (dfh->frame_subscriber_ && subscriber_texture->texture_id())
dfh->idle_frame_subscriber_textures_.push_back(subscriber_texture);
@@ -734,19 +726,19 @@ void DelegatedFrameHost::CopyFromCompositingSurfaceFinishedForVideo(
bool result) {
callback.Run(result);
- uint32 sync_point = 0;
+ gpu::SyncToken sync_token;
if (result) {
GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
- sync_point = gl_helper->InsertSyncPoint();
+ sync_token = gpu::SyncToken(gl_helper->InsertSyncPoint());
}
if (release_callback) {
// A release callback means the texture came from the compositor, so there
// should be no |subscriber_texture|.
DCHECK(!subscriber_texture.get());
- bool lost_resource = sync_point == 0;
- release_callback->Run(sync_point, lost_resource);
+ const bool lost_resource = !sync_token.HasData();
+ release_callback->Run(sync_token, lost_resource);
}
- ReturnSubscriberTexture(dfh, subscriber_texture, sync_point);
+ ReturnSubscriberTexture(dfh, subscriber_texture, sync_token);
}
// static
@@ -757,8 +749,8 @@ void DelegatedFrameHost::CopyFromCompositingSurfaceHasResultForVideo(
const base::Callback<void(bool)>& callback,
scoped_ptr<cc::CopyOutputResult> result) {
base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false));
- base::ScopedClosureRunner scoped_return_subscriber_texture(
- base::Bind(&ReturnSubscriberTexture, dfh, subscriber_texture, 0));
+ base::ScopedClosureRunner scoped_return_subscriber_texture(base::Bind(
+ &ReturnSubscriberTexture, dfh, subscriber_texture, gpu::SyncToken()));
if (!dfh)
return;
@@ -866,11 +858,9 @@ void DelegatedFrameHost::CopyFromCompositingSurfaceHasResultForVideo(
callback,
subscriber_texture,
base::Passed(&release_callback));
- yuv_readback_pipeline->ReadbackYUV(texture_mailbox.mailbox(),
- texture_mailbox.sync_point(),
- video_frame.get(),
- region_in_frame.origin(),
- finished_callback);
+ yuv_readback_pipeline->ReadbackYUV(
+ texture_mailbox.mailbox(), texture_mailbox.sync_token(),
+ video_frame.get(), region_in_frame.origin(), finished_callback);
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « content/browser/compositor/delegated_frame_host.h ('k') | content/browser/compositor/owned_mailbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698