| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 m_canvas = nullptr; | 168 m_canvas = nullptr; |
| 169 } | 169 } |
| 170 if (offscreenCanvas()) { | 170 if (offscreenCanvas()) { |
| 171 offscreenCanvas()->detachContext(); | 171 offscreenCanvas()->detachContext(); |
| 172 m_offscreenCanvas = nullptr; | 172 m_offscreenCanvas = nullptr; |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 void CanvasRenderingContext::didDraw(const SkIRect& dirtyRect) { | 176 void CanvasRenderingContext::didDraw(const SkIRect& dirtyRect) { |
| 177 canvas()->didDraw(SkRect::Make(dirtyRect)); | 177 canvas()->didDraw(SkRect::Make(dirtyRect)); |
| 178 scheduleFinalizeFrameIfNeeded(); |
| 179 } |
| 180 |
| 181 void CanvasRenderingContext::didDraw() { |
| 182 canvas()->didDraw(); |
| 183 scheduleFinalizeFrameIfNeeded(); |
| 184 } |
| 185 |
| 186 void CanvasRenderingContext::scheduleFinalizeFrameIfNeeded() { |
| 178 if (!m_finalizeFrameScheduled) { | 187 if (!m_finalizeFrameScheduled) { |
| 179 m_finalizeFrameScheduled = true; | 188 m_finalizeFrameScheduled = true; |
| 180 Platform::current()->currentThread()->addTaskObserver(this); | 189 Platform::current()->currentThread()->addTaskObserver(this); |
| 181 } | 190 } |
| 182 } | 191 } |
| 183 | 192 |
| 184 void CanvasRenderingContext::didProcessTask() { | 193 void CanvasRenderingContext::didProcessTask() { |
| 185 Platform::current()->currentThread()->removeTaskObserver(this); | 194 Platform::current()->currentThread()->removeTaskObserver(this); |
| 186 m_finalizeFrameScheduled = false; | 195 m_finalizeFrameScheduled = false; |
| 187 | 196 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 254 } |
| 246 return taintOrigin; | 255 return taintOrigin; |
| 247 } | 256 } |
| 248 | 257 |
| 249 DEFINE_TRACE(CanvasRenderingContext) { | 258 DEFINE_TRACE(CanvasRenderingContext) { |
| 250 visitor->trace(m_canvas); | 259 visitor->trace(m_canvas); |
| 251 visitor->trace(m_offscreenCanvas); | 260 visitor->trace(m_offscreenCanvas); |
| 252 } | 261 } |
| 253 | 262 |
| 254 } // namespace blink | 263 } // namespace blink |
| OLD | NEW |