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

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

Issue 9015013: Convert callers to use the new TrackedCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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_graphics_2d_impl.h" 5 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 15 matching lines...) Expand all
26 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" 26 #include "webkit/plugins/ppapi/ppb_image_data_impl.h"
27 #include "webkit/plugins/ppapi/resource_helper.h" 27 #include "webkit/plugins/ppapi/resource_helper.h"
28 28
29 #if defined(OS_MACOSX) 29 #if defined(OS_MACOSX)
30 #include "base/mac/mac_util.h" 30 #include "base/mac/mac_util.h"
31 #include "base/mac/scoped_cftyperef.h" 31 #include "base/mac/scoped_cftyperef.h"
32 #endif 32 #endif
33 33
34 using ppapi::thunk::EnterResourceNoLock; 34 using ppapi::thunk::EnterResourceNoLock;
35 using ppapi::thunk::PPB_ImageData_API; 35 using ppapi::thunk::PPB_ImageData_API;
36 using ppapi::TrackedCallback;
36 37
37 namespace webkit { 38 namespace webkit {
38 namespace ppapi { 39 namespace ppapi {
39 40
40 namespace { 41 namespace {
41 42
42 // Converts a rect inside an image of the given dimensions. The rect may be 43 // Converts a rect inside an image of the given dimensions. The rect may be
43 // NULL to indicate it should be the entire image. If the rect is outside of 44 // NULL to indicate it should be the entire image. If the rect is outside of
44 // the image, this will do nothing and return false. 45 // the image, this will do nothing and return false.
45 bool ValidateAndConvertRect(const PP_Rect* rect, 46 bool ValidateAndConvertRect(const PP_Rect* rect,
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 bound_instance_->InvalidateRect(visible_changed_rect); 341 bound_instance_->InvalidateRect(visible_changed_rect);
341 } 342 }
342 nothing_visible = false; 343 nothing_visible = false;
343 } 344 }
344 } 345 }
345 queued_operations_.clear(); 346 queued_operations_.clear();
346 347
347 if (nothing_visible) { 348 if (nothing_visible) {
348 // There's nothing visible to invalidate so just schedule the callback to 349 // There's nothing visible to invalidate so just schedule the callback to
349 // execute in the next round of the message loop. 350 // execute in the next round of the message loop.
350 ScheduleOffscreenCallback(FlushCallbackData(callback)); 351 ScheduleOffscreenCallback(FlushCallbackData(
352 scoped_refptr<TrackedCallback>(new TrackedCallback(this, callback))));
351 } else { 353 } else {
352 unpainted_flush_callback_.Set(callback); 354 unpainted_flush_callback_.Set(
355 scoped_refptr<TrackedCallback>(new TrackedCallback(this, callback)));
353 } 356 }
354 return PP_OK_COMPLETIONPENDING; 357 return PP_OK_COMPLETIONPENDING;
355 } 358 }
356 359
357 bool PPB_Graphics2D_Impl::ReadImageData(PP_Resource image, 360 bool PPB_Graphics2D_Impl::ReadImageData(PP_Resource image,
358 const PP_Point* top_left) { 361 const PP_Point* top_left) {
359 // Get and validate the image object to paint into. 362 // Get and validate the image object to paint into.
360 EnterResourceNoLock<PPB_ImageData_API> enter(image, true); 363 EnterResourceNoLock<PPB_ImageData_API> enter(image, true);
361 if (enter.failed()) 364 if (enter.failed())
362 return false; 365 return false;
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 646 }
644 647
645 bool PPB_Graphics2D_Impl::HasPendingFlush() const { 648 bool PPB_Graphics2D_Impl::HasPendingFlush() const {
646 return !unpainted_flush_callback_.is_null() || 649 return !unpainted_flush_callback_.is_null() ||
647 !painted_flush_callback_.is_null() || 650 !painted_flush_callback_.is_null() ||
648 offscreen_flush_pending_; 651 offscreen_flush_pending_;
649 } 652 }
650 653
651 } // namespace ppapi 654 } // namespace ppapi
652 } // namespace webkit 655 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698