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

Unified Diff: ppapi/proxy/compositor_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_resource.h ('k') | ppapi/tests/test_compositor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/compositor_resource.cc
diff --git a/ppapi/proxy/compositor_resource.cc b/ppapi/proxy/compositor_resource.cc
index 3ada734849839aca56078ac7e3859b6d574df1a6..443d7a949e977bab3394e8e7c0fe181d02eed7ac 100644
--- a/ppapi/proxy/compositor_resource.cc
+++ b/ppapi/proxy/compositor_resource.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/thunk/enter.h"
namespace ppapi {
namespace proxy {
@@ -18,8 +19,25 @@ CompositorResource::CompositorResource(Connection connection,
SendCreate(RENDERER, PpapiHostMsg_Compositor_Create());
}
+bool CompositorResource::IsInProgress() const {
+ ProxyLock::AssertAcquiredDebugOnly();
+ return TrackedCallback::IsPending(commit_callback_);
+}
+
+int32_t CompositorResource::GenerateResourceId() const {
+ ProxyLock::AssertAcquiredDebugOnly();
+ return ++last_resource_id_;
+}
+
CompositorResource::~CompositorResource() {
- ResetLayersInternal();
+ ResetLayersInternal(true);
+
+ // Abort all release callbacks.
+ for (ReleaseCallbackMap::iterator it = release_callback_map_.begin();
+ it != release_callback_map_.end(); ++it) {
+ if (!it->second.is_null())
+ it->second.Run(PP_ERROR_ABORTED, 0, false);
+ }
}
thunk::PPB_Compositor_API* CompositorResource::AsPPB_Compositor_API() {
@@ -74,7 +92,8 @@ int32_t CompositorResource::CommitLayers(
int32_t CompositorResource::ResetLayers() {
if (IsInProgress())
return PP_ERROR_INPROGRESS;
- ResetLayersInternal();
+
+ ResetLayersInternal(false);
return PP_OK;
}
@@ -112,16 +131,16 @@ void CompositorResource::OnPluginMsgReleaseResource(
ReleaseCallbackMap::iterator it = release_callback_map_.find(id);
DCHECK(it != release_callback_map_.end()) <<
"Can not found release_callback_ by id(" << id << ")!";
- it->second.Run(sync_point, is_lost);
+ it->second.Run(PP_OK, sync_point, is_lost);
release_callback_map_.erase(it);
}
-void CompositorResource::ResetLayersInternal() {
+void CompositorResource::ResetLayersInternal(bool is_aborted) {
for (LayerList::iterator it = layers_.begin();
it != layers_.end(); ++it) {
ReleaseCallback release_callback = (*it)->release_callback();
if (!release_callback.is_null()) {
- release_callback.Run(0, false);
+ release_callback.Run(is_aborted ? PP_ERROR_ABORTED : PP_OK, 0, false);
(*it)->ResetReleaseCallback();
}
(*it)->Invalidate();
« no previous file with comments | « ppapi/proxy/compositor_resource.h ('k') | ppapi/tests/test_compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698