| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 m_canvas = nullptr; | 158 m_canvas = nullptr; |
| 159 } | 159 } |
| 160 if (offscreenCanvas()) { | 160 if (offscreenCanvas()) { |
| 161 offscreenCanvas()->detachContext(); | 161 offscreenCanvas()->detachContext(); |
| 162 m_offscreenCanvas = nullptr; | 162 m_offscreenCanvas = nullptr; |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 void CanvasRenderingContext::didDraw(const SkIRect& dirtyRect) { | 166 void CanvasRenderingContext::didDraw(const SkIRect& dirtyRect) { |
| 167 canvas()->didDraw(SkRect::Make(dirtyRect)); | 167 canvas()->didDraw(SkRect::Make(dirtyRect)); |
| 168 scheduleFinalizeFrameIfNeeded(); |
| 169 } |
| 170 |
| 171 void CanvasRenderingContext::didDraw() { |
| 172 canvas()->didDraw(); |
| 173 scheduleFinalizeFrameIfNeeded(); |
| 174 } |
| 175 |
| 176 void CanvasRenderingContext::scheduleFinalizeFrameIfNeeded() { |
| 168 if (!m_finalizeFrameScheduled) { | 177 if (!m_finalizeFrameScheduled) { |
| 169 m_finalizeFrameScheduled = true; | 178 m_finalizeFrameScheduled = true; |
| 170 Platform::current()->currentThread()->addTaskObserver(this); | 179 Platform::current()->currentThread()->addTaskObserver(this); |
| 171 } | 180 } |
| 172 } | 181 } |
| 173 | 182 |
| 174 void CanvasRenderingContext::didProcessTask() { | 183 void CanvasRenderingContext::didProcessTask() { |
| 175 Platform::current()->currentThread()->removeTaskObserver(this); | 184 Platform::current()->currentThread()->removeTaskObserver(this); |
| 176 m_finalizeFrameScheduled = false; | 185 m_finalizeFrameScheduled = false; |
| 177 | 186 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 244 } |
| 236 return taintOrigin; | 245 return taintOrigin; |
| 237 } | 246 } |
| 238 | 247 |
| 239 DEFINE_TRACE(CanvasRenderingContext) { | 248 DEFINE_TRACE(CanvasRenderingContext) { |
| 240 visitor->trace(m_canvas); | 249 visitor->trace(m_canvas); |
| 241 visitor->trace(m_offscreenCanvas); | 250 visitor->trace(m_offscreenCanvas); |
| 242 } | 251 } |
| 243 | 252 |
| 244 } // namespace blink | 253 } // namespace blink |
| OLD | NEW |