| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
| 11 | 11 |
| 12 namespace pp { | 12 namespace pp { |
| 13 | 13 |
| 14 PaintManager::PaintManager() | 14 PaintManager::PaintManager() |
| 15 : instance_(NULL), | 15 : instance_(NULL), |
| 16 client_(NULL), | 16 client_(NULL), |
| 17 is_always_opaque_(false), | 17 is_always_opaque_(false), |
| 18 callback_factory_(NULL) { | 18 callback_factory_(NULL), |
| 19 manual_callback_pending_(false), |
| 20 flush_pending_(false) { |
| 19 // Set the callback object outside of the initializer list to avoid a | 21 // Set the callback object outside of the initializer list to avoid a |
| 20 // compiler warning about using "this" in an initializer list. | 22 // compiler warning about using "this" in an initializer list. |
| 21 callback_factory_.Initialize(this); | 23 callback_factory_.Initialize(this); |
| 22 } | 24 } |
| 23 | 25 |
| 24 PaintManager::PaintManager(Instance* instance, | 26 PaintManager::PaintManager(Instance* instance, |
| 25 Client* client, | 27 Client* client, |
| 26 bool is_always_opaque) | 28 bool is_always_opaque) |
| 27 : instance_(instance), | 29 : instance_(instance), |
| 28 client_(client), | 30 client_(client), |
| 29 is_always_opaque_(is_always_opaque), | 31 is_always_opaque_(is_always_opaque), |
| 30 callback_factory_(NULL) { | 32 callback_factory_(NULL), |
| 33 manual_callback_pending_(false), |
| 34 flush_pending_(false) { |
| 31 // Set the callback object outside of the initializer list to avoid a | 35 // Set the callback object outside of the initializer list to avoid a |
| 32 // compiler warning about using "this" in an initializer list. | 36 // compiler warning about using "this" in an initializer list. |
| 33 callback_factory_.Initialize(this); | 37 callback_factory_.Initialize(this); |
| 34 | 38 |
| 35 // You can not use a NULL client pointer. | 39 // You can not use a NULL client pointer. |
| 36 PP_DCHECK(client); | 40 PP_DCHECK(client); |
| 37 } | 41 } |
| 38 | 42 |
| 39 PaintManager::~PaintManager() { | 43 PaintManager::~PaintManager() { |
| 40 } | 44 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 164 } |
| 161 | 165 |
| 162 void PaintManager::OnManualCallbackComplete(int32_t) { | 166 void PaintManager::OnManualCallbackComplete(int32_t) { |
| 163 PP_DCHECK(manual_callback_pending_); | 167 PP_DCHECK(manual_callback_pending_); |
| 164 manual_callback_pending_ = false; | 168 manual_callback_pending_ = false; |
| 165 | 169 |
| 166 // 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 |
| 167 // invalid regions. Even though we only schedule this callback when something | 171 // invalid regions. Even though we only schedule this callback when something |
| 168 // 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 |
| 169 // executed and that could have cleared the queue. | 173 // executed and that could have cleared the queue. |
| 170 if (aggregator_.HasPendingUpdate()) | 174 if (aggregator_.HasPendingUpdate() && !flush_pending_) |
| 171 DoPaint(); | 175 DoPaint(); |
| 172 } | 176 } |
| 173 | 177 |
| 174 } // namespace pp | 178 } // namespace pp |
| OLD | NEW |