| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 needsFinalizeFrame(); | 168 needsFinalizeFrame(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void CanvasRenderingContext::didDraw() { |
| 172 canvas()->didDraw(); |
| 173 needsFinalizeFrame(); |
| 174 } |
| 175 |
| 171 void CanvasRenderingContext::needsFinalizeFrame() { | 176 void CanvasRenderingContext::needsFinalizeFrame() { |
| 172 if (!m_finalizeFrameScheduled) { | 177 if (!m_finalizeFrameScheduled) { |
| 173 m_finalizeFrameScheduled = true; | 178 m_finalizeFrameScheduled = true; |
| 174 Platform::current()->currentThread()->addTaskObserver(this); | 179 Platform::current()->currentThread()->addTaskObserver(this); |
| 175 } | 180 } |
| 176 } | 181 } |
| 177 | 182 |
| 178 void CanvasRenderingContext::didProcessTask() { | 183 void CanvasRenderingContext::didProcessTask() { |
| 179 Platform::current()->currentThread()->removeTaskObserver(this); | 184 Platform::current()->currentThread()->removeTaskObserver(this); |
| 180 m_finalizeFrameScheduled = false; | 185 m_finalizeFrameScheduled = false; |
| 181 | |
| 182 // The end of a script task that drew content to the canvas is the point | 186 // The end of a script task that drew content to the canvas is the point |
| 183 // at which the current frame may be considered complete. | 187 // at which the current frame may be considered complete. |
| 184 if (canvas()) | 188 if (canvas()) |
| 185 canvas()->finalizeFrame(); | 189 canvas()->finalizeFrame(); |
| 186 if (offscreenCanvas()) | 190 if (offscreenCanvas()) |
| 187 offscreenCanvas()->finalizeFrame(); | 191 offscreenCanvas()->finalizeFrame(); |
| 188 finalizeFrame(); | 192 finalizeFrame(); |
| 189 } | 193 } |
| 190 | 194 |
| 191 CanvasRenderingContext::ContextType CanvasRenderingContext::contextTypeFromId( | 195 CanvasRenderingContext::ContextType CanvasRenderingContext::contextTypeFromId( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 245 } |
| 242 return taintOrigin; | 246 return taintOrigin; |
| 243 } | 247 } |
| 244 | 248 |
| 245 DEFINE_TRACE(CanvasRenderingContext) { | 249 DEFINE_TRACE(CanvasRenderingContext) { |
| 246 visitor->trace(m_canvas); | 250 visitor->trace(m_canvas); |
| 247 visitor->trace(m_offscreenCanvas); | 251 visitor->trace(m_offscreenCanvas); |
| 248 } | 252 } |
| 249 | 253 |
| 250 } // namespace blink | 254 } // namespace blink |
| OLD | NEW |