| OLD | NEW |
| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 aggregator_.ClearPendingUpdate(); | 126 aggregator_.ClearPendingUpdate(); |
| 127 | 127 |
| 128 // Apply any scroll before asking the client to paint. | 128 // Apply any scroll before asking the client to paint. |
| 129 if (update.has_scroll) | 129 if (update.has_scroll) |
| 130 graphics_.Scroll(update.scroll_rect, update.scroll_delta); | 130 graphics_.Scroll(update.scroll_rect, update.scroll_delta); |
| 131 | 131 |
| 132 if (!client_->OnPaint(graphics_, update.paint_rects, update.paint_bounds)) | 132 if (!client_->OnPaint(graphics_, update.paint_rects, update.paint_bounds)) |
| 133 return; // Nothing was painted, don't schedule a flush. | 133 return; // Nothing was painted, don't schedule a flush. |
| 134 | 134 |
| 135 int32_t result = graphics_.Flush( | 135 int32_t result = graphics_.Flush( |
| 136 callback_factory_.NewCallback(&PaintManager::OnFlushComplete)); | 136 callback_factory_.NewOptionalCallback(&PaintManager::OnFlushComplete)); |
| 137 | 137 |
| 138 // If you trigger this assertion, then your plugin has called Flush() | 138 // If you trigger this assertion, then your plugin has called Flush() |
| 139 // manually. When using the PaintManager, you should not call Flush, it will | 139 // manually. When using the PaintManager, you should not call Flush, it will |
| 140 // handle that for you because it needs to know when it can do the next paint | 140 // handle that for you because it needs to know when it can do the next paint |
| 141 // by implementing the flush callback. | 141 // by implementing the flush callback. |
| 142 // | 142 // |
| 143 // Another possible cause of this assertion is re-using devices. If you | 143 // Another possible cause of this assertion is re-using devices. If you |
| 144 // use one device, swap it with another, then swap it back, we won't know | 144 // use one device, swap it with another, then swap it back, we won't know |
| 145 // that we've already scheduled a Flush on the first device. It's best to not | 145 // that we've already scheduled a Flush on the first device. It's best to not |
| 146 // re-use devices in this way. | 146 // re-use devices in this way. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 169 | 169 |
| 170 // Just because we have a manual callback doesn't mean there are actually any | 170 // Just because we have a manual callback doesn't mean there are actually any |
| 171 // invalid regions. Even though we only schedule this callback when something | 171 // invalid regions. Even though we only schedule this callback when something |
| 172 // is pending, a Flush callback could have come in before this callback was | 172 // is pending, a Flush callback could have come in before this callback was |
| 173 // executed and that could have cleared the queue. | 173 // executed and that could have cleared the queue. |
| 174 if (aggregator_.HasPendingUpdate() && !flush_pending_) | 174 if (aggregator_.HasPendingUpdate() && !flush_pending_) |
| 175 DoPaint(); | 175 DoPaint(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace pp | 178 } // namespace pp |
| OLD | NEW |