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

Side by Side Diff: Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h

Issue 16032003: Fixing Canvas2DLayerBridge to handle lost graphics contexts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixing gpu_test Canvas2DAllowed Created 7 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 enum OpacityMode { 49 enum OpacityMode {
50 Opaque, 50 Opaque,
51 NonOpaque 51 NonOpaque
52 }; 52 };
53 53
54 enum ThreadMode { 54 enum ThreadMode {
55 SingleThread, 55 SingleThread,
56 Threaded 56 Threaded
57 }; 57 };
58 58
59 static PassOwnPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D> context, SkDeferredCanvas* canvas, OpacityMode opacityMode, ThreadMode threading ) 59 static PassOwnPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D>, const IntSize&, OpacityMode, ThreadMode);
60 {
61 return adoptPtr(new Canvas2DLayerBridge(context, canvas, opacityMode, th reading));
62 }
63 60
64 virtual ~Canvas2DLayerBridge(); 61 virtual ~Canvas2DLayerBridge();
65 62
66 // WebKit::WebExternalTextureLayerClient implementation. 63 // WebKit::WebExternalTextureLayerClient implementation.
67 virtual unsigned prepareTexture(WebKit::WebTextureUpdater&) OVERRIDE; 64 virtual unsigned prepareTexture(WebKit::WebTextureUpdater&) OVERRIDE;
68 virtual WebKit::WebGraphicsContext3D* context() OVERRIDE; 65 virtual WebKit::WebGraphicsContext3D* context() OVERRIDE;
69 virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*) OVERRIDE; 66 virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*) OVERRIDE;
70 virtual void mailboxReleased(const WebKit::WebExternalTextureMailbox&) OVERR IDE; 67 virtual void mailboxReleased(const WebKit::WebExternalTextureMailbox&) OVERR IDE;
71 68
72 // SkDeferredCanvas::NotificationClient implementation 69 // SkDeferredCanvas::NotificationClient implementation
73 virtual void prepareForDraw() OVERRIDE; 70 virtual void prepareForDraw() OVERRIDE;
74 virtual void storageAllocatedForRecordingChanged(size_t) OVERRIDE; 71 virtual void storageAllocatedForRecordingChanged(size_t) OVERRIDE;
75 virtual void flushedDrawCommands() OVERRIDE; 72 virtual void flushedDrawCommands() OVERRIDE;
76 virtual void skippedPendingDrawCommands() OVERRIDE; 73 virtual void skippedPendingDrawCommands() OVERRIDE;
77 74
78 // Methods used by Canvas2DLayerManager 75 // Methods used by Canvas2DLayerManager
79 virtual size_t freeMemoryIfPossible(size_t); // virtual for mocking 76 virtual size_t freeMemoryIfPossible(size_t); // virtual for mocking
80 virtual void flush(); // virtual for mocking 77 virtual void flush(); // virtual for mocking
81 virtual size_t storageAllocatedForRecording(); // virtual for faking 78 virtual size_t storageAllocatedForRecording(); // virtual for faking
82 size_t bytesAllocated() const {return m_bytesAllocated;} 79 size_t bytesAllocated() const {return m_bytesAllocated;}
83 void limitPendingFrames(); 80 void limitPendingFrames();
84 81
85 WebKit::WebLayer* layer(); 82 WebKit::WebLayer* layer();
86 void contextAcquired(); 83 void contextAcquired();
84 SkCanvas* getCanvas() { return m_canvas; }
87 85
88 unsigned backBufferTexture(); 86 unsigned backBufferTexture();
89 87
88 bool isValid();
89
90 protected: 90 protected:
91 // Special constructor only used for unit testing
Stephen White 2013/07/04 16:11:56 Nit: Is this comment stale? It looks like there's
Justin Novosad 2013/07/04 17:34:04 Done.
91 Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, SkDeferredCanvas*, Opacit yMode, ThreadMode); 92 Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, SkDeferredCanvas*, Opacit yMode, ThreadMode);
92 93
93 SkDeferredCanvas* m_canvas; 94 SkDeferredCanvas* m_canvas;
94 OwnPtr<WebKit::WebExternalTextureLayer> m_layer; 95 OwnPtr<WebKit::WebExternalTextureLayer> m_layer;
95 RefPtr<GraphicsContext3D> m_context; 96 RefPtr<GraphicsContext3D> m_context;
96 size_t m_bytesAllocated; 97 size_t m_bytesAllocated;
97 bool m_didRecordDrawCommand; 98 bool m_didRecordDrawCommand;
99 bool m_surfaceIsValid;
98 int m_framesPending; 100 int m_framesPending;
99 101
100 friend class WTF::DoublyLinkedListNode<Canvas2DLayerBridge>; 102 friend class WTF::DoublyLinkedListNode<Canvas2DLayerBridge>;
101 Canvas2DLayerBridge* m_next; 103 Canvas2DLayerBridge* m_next;
102 Canvas2DLayerBridge* m_prev; 104 Canvas2DLayerBridge* m_prev;
103 105
104 #if ENABLE(CANVAS_USES_MAILBOX) 106 #if ENABLE(CANVAS_USES_MAILBOX)
105 enum MailboxStatus { 107 enum MailboxStatus {
106 MailboxInUse, 108 MailboxInUse,
107 MailboxReleased, 109 MailboxReleased,
(...skipping 11 matching lines...) Expand all
119 MailboxInfo* createMailboxInfo(); 121 MailboxInfo* createMailboxInfo();
120 122
121 uint32_t m_lastImageId; 123 uint32_t m_lastImageId;
122 Vector<MailboxInfo> m_mailboxes; 124 Vector<MailboxInfo> m_mailboxes;
123 #endif 125 #endif
124 }; 126 };
125 127
126 } 128 }
127 129
128 #endif 130 #endif
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/ImageBuffer.cpp ('k') | Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698