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

Side by Side Diff: ppapi/cpp/paint_manager.cc

Issue 6899055: PPAPI: Force async callback invocation option. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
« no previous file with comments | « ppapi/cpp/graphics_2d.cc ('k') | ppapi/cpp/private/flash_menu.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ppapi/cpp/paint_manager.h" 5 #include "ppapi/cpp/paint_manager.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/cpp/instance.h" 8 #include "ppapi/cpp/instance.h"
9 #include "ppapi/cpp/logging.h" 9 #include "ppapi/cpp/logging.h"
10 #include "ppapi/cpp/module.h" 10 #include "ppapi/cpp/module.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 pending_size_ = Size(); 146 pending_size_ = Size();
147 } 147 }
148 148
149 // Apply any scroll before asking the client to paint. 149 // Apply any scroll before asking the client to paint.
150 if (update.has_scroll) 150 if (update.has_scroll)
151 graphics_.Scroll(update.scroll_rect, update.scroll_delta); 151 graphics_.Scroll(update.scroll_rect, update.scroll_delta);
152 152
153 if (client_->OnPaint(graphics_, update.paint_rects, update.paint_bounds)) { 153 if (client_->OnPaint(graphics_, update.paint_rects, update.paint_bounds)) {
154 // Something was painted, schedule a flush. 154 // Something was painted, schedule a flush.
155 int32_t result = graphics_.Flush( 155 int32_t result = graphics_.Flush(
156 callback_factory_.NewCallback(&PaintManager::OnFlushComplete)); 156 callback_factory_.NewOptionalCallback(&PaintManager::OnFlushComplete));
157 157
158 // If you trigger this assertion, then your plugin has called Flush() 158 // If you trigger this assertion, then your plugin has called Flush()
159 // manually. When using the PaintManager, you should not call Flush, it 159 // manually. When using the PaintManager, you should not call Flush, it
160 // will handle that for you because it needs to know when it can do the 160 // will handle that for you because it needs to know when it can do the
161 // next paint by implementing the flush callback. 161 // next paint by implementing the flush callback.
162 // 162 //
163 // Another possible cause of this assertion is re-using devices. If you 163 // Another possible cause of this assertion is re-using devices. If you
164 // use one device, swap it with another, then swap it back, we won't know 164 // use one device, swap it with another, then swap it back, we won't know
165 // that we've already scheduled a Flush on the first device. It's best to 165 // that we've already scheduled a Flush on the first device. It's best to
166 // not re-use devices in this way. 166 // not re-use devices in this way.
(...skipping 27 matching lines...) Expand all
194 // Just because we have a manual callback doesn't mean there are actually any 194 // Just because we have a manual callback doesn't mean there are actually any
195 // invalid regions. Even though we only schedule this callback when something 195 // invalid regions. Even though we only schedule this callback when something
196 // is pending, a Flush callback could have come in before this callback was 196 // is pending, a Flush callback could have come in before this callback was
197 // executed and that could have cleared the queue. 197 // executed and that could have cleared the queue.
198 if (aggregator_.HasPendingUpdate() && !flush_pending_) 198 if (aggregator_.HasPendingUpdate() && !flush_pending_)
199 DoPaint(); 199 DoPaint();
200 } 200 }
201 201
202 202
203 } // namespace pp 203 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/graphics_2d.cc ('k') | ppapi/cpp/private/flash_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698