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

Side by Side Diff: webkit/plugins/ppapi/ppb_flash_menu_impl.cc

Issue 7629017: Add a unified resource tracker shared between the proxy and the impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_flash_menu_impl.h" 5 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "ppapi/c/pp_completion_callback.h" 8 #include "ppapi/c/pp_completion_callback.h"
9 #include "ui/gfx/point.h" 9 #include "ui/gfx/point.h"
10 #include "webkit/glue/webmenuitem.h" 10 #include "webkit/glue/webmenuitem.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 return PP_ERROR_BADARGUMENT; 134 return PP_ERROR_BADARGUMENT;
135 135
136 if (!callback.func) { 136 if (!callback.func) {
137 NOTIMPLEMENTED(); 137 NOTIMPLEMENTED();
138 return PP_ERROR_BADARGUMENT; 138 return PP_ERROR_BADARGUMENT;
139 } 139 }
140 140
141 if (callback_.get() && !callback_->completed()) 141 if (callback_.get() && !callback_->completed())
142 return PP_ERROR_INPROGRESS; 142 return PP_ERROR_INPROGRESS;
143 143
144 PP_Resource resource_id = GetReferenceNoAddRef();
145 if (!resource_id) {
146 NOTREACHED();
147 return PP_ERROR_FAILED;
148 }
149
150 int32_t rv = instance()->delegate()->ShowContextMenu( 144 int32_t rv = instance()->delegate()->ShowContextMenu(
151 instance(), this, gfx::Point(location->x, location->y)); 145 instance(), this, gfx::Point(location->x, location->y));
152 if (rv == PP_OK_COMPLETIONPENDING) { 146 if (rv == PP_OK_COMPLETIONPENDING) {
153 // Record callback and output buffers. 147 // Record callback and output buffers.
154 callback_ = new TrackedCompletionCallback( 148 callback_ = new TrackedCompletionCallback(
155 instance()->module()->GetCallbackTracker(), resource_id, callback); 149 instance()->module()->GetCallbackTracker(), pp_resource(), callback);
156 selected_id_out_ = selected_id_out; 150 selected_id_out_ = selected_id_out;
157 } else { 151 } else {
158 // This should never be completed synchronously successfully. 152 // This should never be completed synchronously successfully.
159 DCHECK_NE(rv, PP_OK); 153 DCHECK_NE(rv, PP_OK);
160 } 154 }
161 return rv; 155 return rv;
162 156
163 NOTIMPLEMENTED(); 157 NOTIMPLEMENTED();
164 return PP_ERROR_FAILED; 158 return PP_ERROR_FAILED;
165 } 159 }
(...skipping 19 matching lines...) Expand all
185 179
186 scoped_refptr<TrackedCompletionCallback> callback; 180 scoped_refptr<TrackedCompletionCallback> callback;
187 callback.swap(callback_); 181 callback.swap(callback_);
188 selected_id_out_ = NULL; 182 selected_id_out_ = NULL;
189 183
190 callback->Run(rv); // Will complete abortively if necessary. 184 callback->Run(rv); // Will complete abortively if necessary.
191 } 185 }
192 186
193 } // namespace ppapi 187 } // namespace ppapi
194 } // namespace webkit 188 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698