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

Side by Side Diff: Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp

Issue 8333009: Merge 97451 - Clear WebMediaPlayerClientImpl back pointer on destruction (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 2 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 VideoFrameProvider* pr ovider) 49 VideoFrameProvider* pr ovider)
50 { 50 {
51 return adoptRef(new VideoLayerChromium(owner, provider)); 51 return adoptRef(new VideoLayerChromium(owner, provider));
52 } 52 }
53 53
54 VideoLayerChromium::VideoLayerChromium(GraphicsLayerChromium* owner, VideoFrameP rovider* provider) 54 VideoLayerChromium::VideoLayerChromium(GraphicsLayerChromium* owner, VideoFrameP rovider* provider)
55 : LayerChromium(owner) 55 : LayerChromium(owner)
56 , m_skipsDraw(true) 56 , m_skipsDraw(true)
57 , m_frameFormat(VideoFrameChromium::Invalid) 57 , m_frameFormat(VideoFrameChromium::Invalid)
58 , m_provider(provider) 58 , m_provider(provider)
59 , m_currentFrame(0)
60 { 59 {
61 } 60 }
62 61
63 VideoLayerChromium::~VideoLayerChromium() 62 VideoLayerChromium::~VideoLayerChromium()
64 { 63 {
65 cleanupResources(); 64 cleanupResources();
66 } 65 }
67 66
68 PassRefPtr<CCLayerImpl> VideoLayerChromium::createCCLayerImpl() 67 PassRefPtr<CCLayerImpl> VideoLayerChromium::createCCLayerImpl()
69 { 68 {
70 return CCVideoLayerImpl::create(m_layerId); 69 return CCVideoLayerImpl::create(m_layerId);
71 } 70 }
72 71
73 void VideoLayerChromium::cleanupResources() 72 void VideoLayerChromium::cleanupResources()
74 { 73 {
75 LayerChromium::cleanupResources(); 74 LayerChromium::cleanupResources();
76 for (size_t i = 0; i < 3; ++i) 75 for (size_t i = 0; i < 3; ++i)
77 m_textures[i].m_texture.clear(); 76 m_textures[i].m_texture.clear();
78 releaseCurrentFrame();
79 } 77 }
80 78
81 void VideoLayerChromium::updateCompositorResources(GraphicsContext3D* context) 79 void VideoLayerChromium::updateCompositorResources(GraphicsContext3D* context)
82 { 80 {
83 if (!m_contentsDirty || !m_owner) 81 if (!m_contentsDirty || !m_owner || !m_provider)
84 return; 82 return;
85 83
86 RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->clie nt()); 84 RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->clie nt());
87 if (!backing || backing->paintingGoesToWindow()) 85 if (!backing || backing->paintingGoesToWindow())
88 return; 86 return;
89 87
90 ASSERT(drawsContent()); 88 ASSERT(drawsContent());
91 89
92 m_skipsDraw = false; 90 m_skipsDraw = false;
93 VideoFrameChromium* frame = m_provider->getCurrentFrame(); 91 VideoFrameChromium* frame = m_provider->getCurrentFrame();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 memcpy(mem, data, dimensions.width() * dimensions.height()); 237 memcpy(mem, data, dimensions.width() * dimensions.height());
240 GLC(context, static_cast<Extensions3DChromium*>(context->getExtensions() )->unmapTexSubImage2DCHROMIUM(mem)); 238 GLC(context, static_cast<Extensions3DChromium*>(context->getExtensions() )->unmapTexSubImage2DCHROMIUM(mem));
241 } else { 239 } else {
242 // If mapTexSubImage2DCHROMIUM fails, then do the slower texSubImage2D 240 // If mapTexSubImage2DCHROMIUM fails, then do the slower texSubImage2D
243 // upload. This does twice the copies as mapTexSubImage2DCHROMIUM, one 241 // upload. This does twice the copies as mapTexSubImage2DCHROMIUM, one
244 // in the command buffer and another to the texture. 242 // in the command buffer and another to the texture.
245 GLC(context, context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, dimensions.width(), dimensions.height(), format, GraphicsContext3D::UNSIGNED _BYTE, data)); 243 GLC(context, context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, dimensions.width(), dimensions.height(), format, GraphicsContext3D::UNSIGNED _BYTE, data));
246 } 244 }
247 } 245 }
248 246
249 void VideoLayerChromium::releaseCurrentFrame() 247 void VideoLayerChromium::releaseProvider()
250 { 248 {
251 if (!m_currentFrame) 249 m_provider = 0;
252 return;
253
254 m_provider->putCurrentFrame(m_currentFrame);
255 m_currentFrame = 0;
256 } 250 }
257 251
258 } // namespace WebCore 252 } // namespace WebCore
259 253
260 #endif // USE(ACCELERATED_COMPOSITING) 254 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h ('k') | Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698