Chromium Code Reviews| 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 m_context.clear(); // Ensure this goes away before the ImageBuffer. | 100 m_context.clear(); // Ensure this goes away before the ImageBuffer. |
|
haraken
2014/04/25 14:30:32
Nit: You can remove this.
Mads Ager (chromium)
2014/04/28 09:45:21
Done.
| |
| 101 } | 101 } |
| 102 | 102 |
| 103 void HTMLCanvasElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) | 103 void HTMLCanvasElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) |
| 104 { | 104 { |
| 105 if (name == widthAttr || name == heightAttr) | 105 if (name == widthAttr || name == heightAttr) |
| 106 reset(); | 106 reset(); |
| 107 HTMLElement::parseAttribute(name, value); | 107 HTMLElement::parseAttribute(name, value); |
| 108 } | 108 } |
| 109 | 109 |
| 110 RenderObject* HTMLCanvasElement::createRenderer(RenderStyle* style) | 110 RenderObject* HTMLCanvasElement::createRenderer(RenderStyle* style) |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 522 } | 522 } |
| 523 | 523 |
| 524 void HTMLCanvasElement::notifySurfaceInvalid() | 524 void HTMLCanvasElement::notifySurfaceInvalid() |
| 525 { | 525 { |
| 526 if (m_context && m_context->is2d()) { | 526 if (m_context && m_context->is2d()) { |
| 527 CanvasRenderingContext2D* context2d = toCanvasRenderingContext2D(m_conte xt.get()); | 527 CanvasRenderingContext2D* context2d = toCanvasRenderingContext2D(m_conte xt.get()); |
| 528 context2d->loseContext(); | 528 context2d->loseContext(); |
| 529 } | 529 } |
| 530 } | 530 } |
| 531 | 531 |
| 532 void HTMLCanvasElement::trace(Visitor* visitor) | |
| 533 { | |
| 534 visitor->trace(m_context); | |
| 535 HTMLElement::trace(visitor); | |
| 536 } | |
| 537 | |
| 532 void HTMLCanvasElement::updateExternallyAllocatedMemory() const | 538 void HTMLCanvasElement::updateExternallyAllocatedMemory() const |
| 533 { | 539 { |
| 534 int bufferCount = 0; | 540 int bufferCount = 0; |
| 535 if (m_imageBuffer) | 541 if (m_imageBuffer) |
| 536 bufferCount++; | 542 bufferCount++; |
| 537 if (is3D()) | 543 if (is3D()) |
| 538 bufferCount += 2; | 544 bufferCount += 2; |
| 539 if (m_copiedImage) | 545 if (m_copiedImage) |
| 540 bufferCount++; | 546 bufferCount++; |
| 541 if (m_presentedImage) | 547 if (m_presentedImage) |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 688 { | 694 { |
| 689 return !originClean(); | 695 return !originClean(); |
| 690 } | 696 } |
| 691 | 697 |
| 692 FloatSize HTMLCanvasElement::sourceSize() const | 698 FloatSize HTMLCanvasElement::sourceSize() const |
| 693 { | 699 { |
| 694 return FloatSize(width(), height()); | 700 return FloatSize(width(), height()); |
| 695 } | 701 } |
| 696 | 702 |
| 697 } | 703 } |
| OLD | NEW |