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

Side by Side Diff: ppapi/proxy/compositor_resource.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: Folded sync_point into sync_tokens 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/proxy/compositor_resource.h" 5 #include "ppapi/proxy/compositor_resource.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/proxy/ppapi_messages.h" 8 #include "ppapi/proxy/ppapi_messages.h"
9 #include "ppapi/thunk/enter.h" 9 #include "ppapi/thunk/enter.h"
10 10
(...skipping 18 matching lines...) Expand all
29 return ++last_resource_id_; 29 return ++last_resource_id_;
30 } 30 }
31 31
32 CompositorResource::~CompositorResource() { 32 CompositorResource::~CompositorResource() {
33 ResetLayersInternal(true); 33 ResetLayersInternal(true);
34 34
35 // Abort all release callbacks. 35 // Abort all release callbacks.
36 for (ReleaseCallbackMap::iterator it = release_callback_map_.begin(); 36 for (ReleaseCallbackMap::iterator it = release_callback_map_.begin();
37 it != release_callback_map_.end(); ++it) { 37 it != release_callback_map_.end(); ++it) {
38 if (!it->second.is_null()) 38 if (!it->second.is_null())
39 it->second.Run(PP_ERROR_ABORTED, 0, false); 39 it->second.Run(PP_ERROR_ABORTED, gpu::SyncToken(), false);
40 } 40 }
41 } 41 }
42 42
43 thunk::PPB_Compositor_API* CompositorResource::AsPPB_Compositor_API() { 43 thunk::PPB_Compositor_API* CompositorResource::AsPPB_Compositor_API() {
44 return this; 44 return this;
45 } 45 }
46 46
47 void CompositorResource::OnReplyReceived( 47 void CompositorResource::OnReplyReceived(
48 const ResourceMessageReplyParams& params, 48 const ResourceMessageReplyParams& params,
49 const IPC::Message& msg) { 49 const IPC::Message& msg) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 scoped_refptr<TrackedCallback> callback; 121 scoped_refptr<TrackedCallback> callback;
122 callback.swap(commit_callback_); 122 callback.swap(commit_callback_);
123 callback->Run(params.result()); 123 callback->Run(params.result());
124 } 124 }
125 125
126 void CompositorResource::OnPluginMsgReleaseResource( 126 void CompositorResource::OnPluginMsgReleaseResource(
127 const ResourceMessageReplyParams& params, 127 const ResourceMessageReplyParams& params,
128 int32_t id, 128 int32_t id,
129 uint32_t sync_point, 129 const gpu::SyncToken& sync_token,
130 bool is_lost) { 130 bool is_lost) {
131 ReleaseCallbackMap::iterator it = release_callback_map_.find(id); 131 ReleaseCallbackMap::iterator it = release_callback_map_.find(id);
132 DCHECK(it != release_callback_map_.end()) << 132 DCHECK(it != release_callback_map_.end()) <<
133 "Can not found release_callback_ by id(" << id << ")!"; 133 "Can not found release_callback_ by id(" << id << ")!";
134 it->second.Run(PP_OK, sync_point, is_lost); 134 it->second.Run(PP_OK, sync_token, is_lost);
135 release_callback_map_.erase(it); 135 release_callback_map_.erase(it);
136 } 136 }
137 137
138 void CompositorResource::ResetLayersInternal(bool is_aborted) { 138 void CompositorResource::ResetLayersInternal(bool is_aborted) {
139 for (LayerList::iterator it = layers_.begin(); 139 for (LayerList::iterator it = layers_.begin();
140 it != layers_.end(); ++it) { 140 it != layers_.end(); ++it) {
141 ReleaseCallback release_callback = (*it)->release_callback(); 141 ReleaseCallback release_callback = (*it)->release_callback();
142 if (!release_callback.is_null()) { 142 if (!release_callback.is_null()) {
143 release_callback.Run(is_aborted ? PP_ERROR_ABORTED : PP_OK, 0, false); 143 release_callback.Run(is_aborted ? PP_ERROR_ABORTED : PP_OK,
144 gpu::SyncToken(), false);
144 (*it)->ResetReleaseCallback(); 145 (*it)->ResetReleaseCallback();
145 } 146 }
146 (*it)->Invalidate(); 147 (*it)->Invalidate();
147 } 148 }
148 149
149 layers_.clear(); 150 layers_.clear();
150 layer_reset_ = true; 151 layer_reset_ = true;
151 } 152 }
152 153
153 } // namespace proxy 154 } // namespace proxy
154 } // namespace ppapi 155 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698