OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return adoptRef(new HTMLCanvasElement(document)); | 90 return adoptRef(new HTMLCanvasElement(document)); |
91 } | 91 } |
92 | 92 |
93 HTMLCanvasElement::~HTMLCanvasElement() | 93 HTMLCanvasElement::~HTMLCanvasElement() |
94 { | 94 { |
95 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_external
lyAllocatedMemory); | 95 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_external
lyAllocatedMemory); |
96 HashSet<CanvasObserver*>::iterator end = m_observers.end(); | 96 HashSet<CanvasObserver*>::iterator end = m_observers.end(); |
97 for (HashSet<CanvasObserver*>::iterator it = m_observers.begin(); it != end;
++it) | 97 for (HashSet<CanvasObserver*>::iterator it = m_observers.begin(); it != end;
++it) |
98 (*it)->canvasDestroyed(this); | 98 (*it)->canvasDestroyed(this); |
99 | 99 |
| 100 #if !ENABLE(OILPAN) |
100 m_context.clear(); // Ensure this goes away before the ImageBuffer. | 101 m_context.clear(); // Ensure this goes away before the ImageBuffer. |
| 102 #endif |
101 } | 103 } |
102 | 104 |
103 void HTMLCanvasElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) | 105 void HTMLCanvasElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) |
104 { | 106 { |
105 if (name == widthAttr || name == heightAttr) | 107 if (name == widthAttr || name == heightAttr) |
106 reset(); | 108 reset(); |
107 HTMLElement::parseAttribute(name, value); | 109 HTMLElement::parseAttribute(name, value); |
108 } | 110 } |
109 | 111 |
110 RenderObject* HTMLCanvasElement::createRenderer(RenderStyle* style) | 112 RenderObject* HTMLCanvasElement::createRenderer(RenderStyle* style) |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 } | 524 } |
523 | 525 |
524 void HTMLCanvasElement::notifySurfaceInvalid() | 526 void HTMLCanvasElement::notifySurfaceInvalid() |
525 { | 527 { |
526 if (m_context && m_context->is2d()) { | 528 if (m_context && m_context->is2d()) { |
527 CanvasRenderingContext2D* context2d = toCanvasRenderingContext2D(m_conte
xt.get()); | 529 CanvasRenderingContext2D* context2d = toCanvasRenderingContext2D(m_conte
xt.get()); |
528 context2d->loseContext(); | 530 context2d->loseContext(); |
529 } | 531 } |
530 } | 532 } |
531 | 533 |
| 534 void HTMLCanvasElement::trace(Visitor* visitor) |
| 535 { |
| 536 visitor->trace(m_context); |
| 537 HTMLElement::trace(visitor); |
| 538 } |
| 539 |
532 void HTMLCanvasElement::updateExternallyAllocatedMemory() const | 540 void HTMLCanvasElement::updateExternallyAllocatedMemory() const |
533 { | 541 { |
534 int bufferCount = 0; | 542 int bufferCount = 0; |
535 if (m_imageBuffer) | 543 if (m_imageBuffer) |
536 bufferCount++; | 544 bufferCount++; |
537 if (is3D()) | 545 if (is3D()) |
538 bufferCount += 2; | 546 bufferCount += 2; |
539 if (m_copiedImage) | 547 if (m_copiedImage) |
540 bufferCount++; | 548 bufferCount++; |
541 if (m_presentedImage) | 549 if (m_presentedImage) |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 { | 696 { |
689 return !originClean(); | 697 return !originClean(); |
690 } | 698 } |
691 | 699 |
692 FloatSize HTMLCanvasElement::sourceSize() const | 700 FloatSize HTMLCanvasElement::sourceSize() const |
693 { | 701 { |
694 return FloatSize(width(), height()); | 702 return FloatSize(width(), height()); |
695 } | 703 } |
696 | 704 |
697 } | 705 } |
OLD | NEW |