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

Unified Diff: ppapi/proxy/compositor_layer_resource.cc

Issue 324983005: [PPAPI] Add browser tests for compositor API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor_api_impl_new
Patch Set: Disable the test on MACOSX Created 6 years, 6 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 | « ppapi/proxy/compositor_layer_resource.h ('k') | ppapi/proxy/compositor_resource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/compositor_layer_resource.cc
diff --git a/ppapi/proxy/compositor_layer_resource.cc b/ppapi/proxy/compositor_layer_resource.cc
index a33f7c17f2ac7ff631f9ce49342e4fe555edc630..17bc7b2fe42287ee34a70608cad23be4e38d319d 100644
--- a/ppapi/proxy/compositor_layer_resource.cc
+++ b/ppapi/proxy/compositor_layer_resource.cc
@@ -32,11 +32,17 @@ void OnTextureReleased(
const ScopedPPResource& context,
uint32_t texture,
const scoped_refptr<TrackedCallback>& release_callback,
+ int32_t result,
uint32_t sync_point,
bool is_lost) {
if (!TrackedCallback::IsPending(release_callback))
return;
+ if (result != PP_OK) {
+ release_callback->Run(result);
+ return;
+ }
+
do {
if (!sync_point)
break;
@@ -59,11 +65,12 @@ void OnImageReleased(
const ScopedPPResource& layer,
const ScopedPPResource& image,
const scoped_refptr<TrackedCallback>& release_callback,
+ int32_t result,
uint32_t sync_point,
bool is_lost) {
if (!TrackedCallback::IsPending(release_callback))
return;
- release_callback->Run(PP_OK);
+ release_callback->Run(result);
}
} // namespace
@@ -105,7 +112,6 @@ int32_t CompositorLayerResource::SetColor(float red,
if (!size)
return PP_ERROR_BADARGUMENT;
-
data_.color->red = clamp(red);
data_.color->green = clamp(green);
data_.color->blue = clamp(blue);
@@ -207,6 +213,11 @@ int32_t CompositorLayerResource::SetImage(
data_.image->source_rect.point = PP_MakeFloatPoint(0.0f, 0.0f);
data_.image->source_rect.size = source_size_;
+ // If the PP_Resource of this layer is released by the plugin, the
+ // release_callback will be aborted immediately, but the texture or image
+ // in this layer may still being used by chromium compositor. So we have to
+ // use ScopedPPResource to keep this resource alive until the texture or image
+ // is released by the chromium compositor.
release_callback_ = base::Bind(
&OnImageReleased,
ScopedPPResource(pp_resource()), // Keep layer alive.
@@ -333,7 +344,7 @@ bool CompositorLayerResource::SetType(LayerType type) {
int32_t CompositorLayerResource::CheckForSetTextureAndImage(
LayerType type,
const scoped_refptr<TrackedCallback>& release_callback) {
- if (!compositor_)
+ if (!compositor_)
return PP_ERROR_BADRESOURCE;
if (compositor_->IsInProgress())
« no previous file with comments | « ppapi/proxy/compositor_layer_resource.h ('k') | ppapi/proxy/compositor_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698