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

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: Fixed unit tests Created 7 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
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 virtual bool isValid(); // virtual for faking
89
90 protected: 90 protected:
91 Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, SkDeferredCanvas*, Opacit yMode, ThreadMode); 91 Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, SkDeferredCanvas*);
92 void init(OpacityMode, 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;
98 int m_framesPending; 99 int m_framesPending;
99 100
100 friend class WTF::DoublyLinkedListNode<Canvas2DLayerBridge>; 101 friend class WTF::DoublyLinkedListNode<Canvas2DLayerBridge>;
101 Canvas2DLayerBridge* m_next; 102 Canvas2DLayerBridge* m_next;
(...skipping 17 matching lines...) Expand all
119 MailboxInfo* createMailboxInfo(); 120 MailboxInfo* createMailboxInfo();
120 121
121 uint32_t m_lastImageId; 122 uint32_t m_lastImageId;
122 Vector<MailboxInfo> m_mailboxes; 123 Vector<MailboxInfo> m_mailboxes;
123 #endif 124 #endif
124 }; 125 };
125 126
126 } 127 }
127 128
128 #endif 129 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698