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

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: Response to senorblanco feedback Created 7 years, 7 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>, SkDeferredCanvas*, OpacityMode, ThreadMode);
60 { 60 static PassOwnPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D>, const IntSize&, OpacityMode, ThreadMode);
61 return adoptPtr(new Canvas2DLayerBridge(context, canvas, opacityMode, th reading));
62 }
63 61
64 virtual ~Canvas2DLayerBridge(); 62 virtual ~Canvas2DLayerBridge();
65 63
66 // WebKit::WebExternalTextureLayerClient implementation. 64 // WebKit::WebExternalTextureLayerClient implementation.
67 virtual unsigned prepareTexture(WebKit::WebTextureUpdater&) OVERRIDE; 65 virtual unsigned prepareTexture(WebKit::WebTextureUpdater&) OVERRIDE;
68 virtual WebKit::WebGraphicsContext3D* context() OVERRIDE; 66 virtual WebKit::WebGraphicsContext3D* context() OVERRIDE;
69 virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*) OVERRIDE; 67 virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*) OVERRIDE;
70 virtual void mailboxReleased(const WebKit::WebExternalTextureMailbox&) OVERR IDE; 68 virtual void mailboxReleased(const WebKit::WebExternalTextureMailbox&) OVERR IDE;
71 69
72 // SkDeferredCanvas::NotificationClient implementation 70 // SkDeferredCanvas::NotificationClient implementation
73 virtual void prepareForDraw() OVERRIDE; 71 virtual void prepareForDraw() OVERRIDE;
74 virtual void storageAllocatedForRecordingChanged(size_t) OVERRIDE; 72 virtual void storageAllocatedForRecordingChanged(size_t) OVERRIDE;
75 virtual void flushedDrawCommands() OVERRIDE; 73 virtual void flushedDrawCommands() OVERRIDE;
76 virtual void skippedPendingDrawCommands() OVERRIDE; 74 virtual void skippedPendingDrawCommands() OVERRIDE;
77 75
78 // Methods used by Canvas2DLayerManager 76 // Methods used by Canvas2DLayerManager
79 virtual size_t freeMemoryIfPossible(size_t); // virtual for mocking 77 virtual size_t freeMemoryIfPossible(size_t); // virtual for mocking
80 virtual void flush(); // virtual for mocking 78 virtual void flush(); // virtual for mocking
81 virtual size_t storageAllocatedForRecording(); // virtual for faking 79 virtual size_t storageAllocatedForRecording(); // virtual for faking
82 size_t bytesAllocated() const {return m_bytesAllocated;} 80 size_t bytesAllocated() const {return m_bytesAllocated;}
83 void limitPendingFrames(); 81 void limitPendingFrames();
84 82
85 WebKit::WebLayer* layer(); 83 WebKit::WebLayer* layer();
86 void contextAcquired(); 84 void contextAcquired();
85 SkCanvas* getCanvas() {return m_canvas;}
87 86
88 unsigned backBufferTexture(); 87 unsigned backBufferTexture();
89 88
89 bool isValid();
90
90 protected: 91 protected:
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;
98 int m_framesPending; 99 int m_framesPending;
99 100
(...skipping 19 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