Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 327633004: Apply DEFINE/DECLARE_NODE_FACTORY(T) macro to element factories with single Document& argument. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLCanvasElement.h ('k') | Source/core/html/HTMLContentElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // Firefox limits width/height to 32767 pixels, but slows down dramatically befo re it 66 // Firefox limits width/height to 32767 pixels, but slows down dramatically befo re it
67 // reaches that limit. We limit by area instead, giving us larger maximum dimens ions, 67 // reaches that limit. We limit by area instead, giving us larger maximum dimens ions,
68 // in exchange for a smaller maximum canvas size. 68 // in exchange for a smaller maximum canvas size.
69 static const int MaxCanvasArea = 32768 * 8192; // Maximum canvas area in CSS pix els 69 static const int MaxCanvasArea = 32768 * 8192; // Maximum canvas area in CSS pix els
70 70
71 //In Skia, we will also limit width/height to 32767. 71 //In Skia, we will also limit width/height to 32767.
72 static const int MaxSkiaDim = 32767; // Maximum width/height in CSS pixels. 72 static const int MaxSkiaDim = 32767; // Maximum width/height in CSS pixels.
73 73
74 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CanvasObserver); 74 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CanvasObserver);
75 75
76 HTMLCanvasElement::HTMLCanvasElement(Document& document) 76 inline HTMLCanvasElement::HTMLCanvasElement(Document& document)
77 : HTMLElement(canvasTag, document) 77 : HTMLElement(canvasTag, document)
78 , DocumentVisibilityObserver(document) 78 , DocumentVisibilityObserver(document)
79 , m_size(DefaultWidth, DefaultHeight) 79 , m_size(DefaultWidth, DefaultHeight)
80 , m_ignoreReset(false) 80 , m_ignoreReset(false)
81 , m_accelerationDisabled(false) 81 , m_accelerationDisabled(false)
82 , m_externallyAllocatedMemory(0) 82 , m_externallyAllocatedMemory(0)
83 , m_originClean(true) 83 , m_originClean(true)
84 , m_didFailToCreateImageBuffer(false) 84 , m_didFailToCreateImageBuffer(false)
85 , m_didClearImageBuffer(false) 85 , m_didClearImageBuffer(false)
86 { 86 {
87 ScriptWrappable::init(this); 87 ScriptWrappable::init(this);
88 } 88 }
89 89
90 PassRefPtrWillBeRawPtr<HTMLCanvasElement> HTMLCanvasElement::create(Document& do cument) 90 DEFINE_NODE_FACTORY(HTMLCanvasElement)
91 {
92 return adoptRefWillBeRefCountedGarbageCollected(new HTMLCanvasElement(docume nt));
93 }
94 91
95 HTMLCanvasElement::~HTMLCanvasElement() 92 HTMLCanvasElement::~HTMLCanvasElement()
96 { 93 {
97 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_external lyAllocatedMemory); 94 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_external lyAllocatedMemory);
98 #if !ENABLE(OILPAN) 95 #if !ENABLE(OILPAN)
99 HashSet<RawPtr<CanvasObserver> >::iterator end = m_observers.end(); 96 HashSet<RawPtr<CanvasObserver> >::iterator end = m_observers.end();
100 for (HashSet<RawPtr<CanvasObserver> >::iterator it = m_observers.begin(); it != end; ++it) 97 for (HashSet<RawPtr<CanvasObserver> >::iterator it = m_observers.begin(); it != end; ++it)
101 (*it)->canvasDestroyed(this); 98 (*it)->canvasDestroyed(this);
102 // Ensure these go away before the ImageBuffer. 99 // Ensure these go away before the ImageBuffer.
103 m_contextStateSaver.clear(); 100 m_contextStateSaver.clear();
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 { 696 {
700 return !originClean(); 697 return !originClean();
701 } 698 }
702 699
703 FloatSize HTMLCanvasElement::sourceSize() const 700 FloatSize HTMLCanvasElement::sourceSize() const
704 { 701 {
705 return FloatSize(width(), height()); 702 return FloatSize(width(), height());
706 } 703 }
707 704
708 } 705 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLCanvasElement.h ('k') | Source/core/html/HTMLContentElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698