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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext.h

Issue 297293004: Adding cache for security origin validations in 2D/WebGL canvases (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: reorganized code 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
OLDNEW
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 18 matching lines...) Expand all
29 #include "core/html/HTMLCanvasElement.h" 29 #include "core/html/HTMLCanvasElement.h"
30 #include "platform/heap/Handle.h" 30 #include "platform/heap/Handle.h"
31 #include "wtf/HashSet.h" 31 #include "wtf/HashSet.h"
32 #include "wtf/Noncopyable.h" 32 #include "wtf/Noncopyable.h"
33 #include "wtf/text/StringHash.h" 33 #include "wtf/text/StringHash.h"
34 34
35 namespace blink { class WebLayer; } 35 namespace blink { class WebLayer; }
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 class CanvasImageSource;
39 class HTMLCanvasElement; 40 class HTMLCanvasElement;
40 class KURL; 41 class KURL;
41 class WebGLObject; 42 class WebGLObject;
42 43
43 class CanvasRenderingContext : public NoBaseWillBeGarbageCollectedFinalized<Canv asRenderingContext> { 44 class CanvasRenderingContext : public NoBaseWillBeGarbageCollectedFinalized<Canv asRenderingContext> {
44 WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); 45 WTF_MAKE_NONCOPYABLE(CanvasRenderingContext);
45 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; 46 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
46 public: 47 public:
47 virtual ~CanvasRenderingContext() { } 48 virtual ~CanvasRenderingContext() { }
48 49
49 #if !ENABLE(OILPAN) 50 #if !ENABLE(OILPAN)
50 void ref() { m_canvas->ref(); } 51 void ref() { m_canvas->ref(); }
51 void deref() { m_canvas->deref(); } 52 void deref() { m_canvas->deref(); }
52 #endif 53 #endif
53 54
54 HTMLCanvasElement* canvas() const { return m_canvas; } 55 HTMLCanvasElement* canvas() const { return m_canvas; }
55 56
56 virtual bool is2d() const { return false; } 57 virtual bool is2d() const { return false; }
57 virtual bool is3d() const { return false; } 58 virtual bool is3d() const { return false; }
58 virtual bool isAccelerated() const { return false; } 59 virtual bool isAccelerated() const { return false; }
59 virtual bool hasAlpha() const { return true; } 60 virtual bool hasAlpha() const { return true; }
60 61
61 virtual void paintRenderingResultsToCanvas() {} 62 virtual void paintRenderingResultsToCanvas() {}
62 63
63 virtual blink::WebLayer* platformLayer() const { return 0; } 64 virtual blink::WebLayer* platformLayer() const { return 0; }
64 65
65 virtual void trace(Visitor* visitor) { visitor->trace(m_canvas); } 66 virtual void trace(Visitor* visitor) { visitor->trace(m_canvas); }
66 67
68 bool wouldTaintOrigin(CanvasImageSource*);
69
67 protected: 70 protected:
68 CanvasRenderingContext(HTMLCanvasElement*); 71 CanvasRenderingContext(HTMLCanvasElement*);
69 72
70 private: 73 private:
71 RawPtrWillBeMember<HTMLCanvasElement> m_canvas; 74 RawPtrWillBeMember<HTMLCanvasElement> m_canvas;
75 HashSet<String> m_cleanURLs;
76 HashSet<String> m_dirtyURLs;
72 }; 77 };
73 78
74 } // namespace WebCore 79 } // namespace WebCore
75 80
76 #endif 81 #endif
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasImageSource.h ('k') | Source/core/html/canvas/CanvasRenderingContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698