Chromium Code Reviews| Index: content/renderer/browser_plugin/browser_plugin.cc |
| diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc |
| index 2c00eb2debb0c5c7a9d2450758e837bfc591a576..6bfe614513fed83029fdb0a01cd0c5d05485a55d 100644 |
| --- a/content/renderer/browser_plugin/browser_plugin.cc |
| +++ b/content/renderer/browser_plugin/browser_plugin.cc |
| @@ -76,11 +76,25 @@ void BrowserPlugin::SetSrcAttribute(const std::string& src) { |
| if (src == src_ && !guest_crashed_) |
| return; |
| if (!src.empty()) { |
| - render_view_->Send(new BrowserPluginHostMsg_NavigateFromEmbedder( |
| - render_view_->GetRoutingID(), |
| - id_, |
| - parent_frame_, |
| - src)); |
| + WebKit::WebView* web_view = render_view_->webview(); |
| + WebGraphicsContext3DCommandBufferImpl* context = static_cast<WebGraphicsContext3DCommandBufferImpl*>(web_view->sharedGraphicsContext3D()); |
| + DCHECK(context); |
| + BrowserPluginHostMsg_Surface_Params params; |
| + params.gpu_process_id = context->GetGPUProcessID(); |
| + params.client_id = context->GetChannelID(); |
| + params.context_id = context->GetContextID(); |
| + params.texture_id[0] = context->createTexture(); |
| + params.texture_id[1] = context->createTexture(); |
| + params.sync_point = context->insertSyncPoint(); |
| + printf("Giving guest textures %u and %u\n", params.texture_id[0], params.texture_id[1]); |
| + if (web_view) { |
| + render_view_->Send(new BrowserPluginHostMsg_NavigateFromEmbedder( |
| + render_view_->GetRoutingID(), |
| + id_, |
| + parent_frame_, |
| + src, |
| + params)); |
| + } |
| } |
| src_ = src; |
| guest_crashed_ = false; |
| @@ -150,12 +164,39 @@ void BrowserPlugin::AdvanceFocus(bool reverse) { |
| render_view_->GetWebView()->advanceFocus(reverse); |
| } |
| +void BrowserPlugin::BuffersSwapped(uint64 surface_handle, const BrowserPlugin_SwapInfo& info) { |
| + DCHECK(surface_handle != 0); |
| + fprintf(stderr, "Browser plugin swapping buffers on surface %lu\n", surface_handle); |
| + container_->setBackingTextureId(surface_handle); |
| + container_->commitBackingTexture(); |
| + compositing_callbacks_.push_back(base::Bind(&BrowserPlugin::PerformBuffersSwappedACK, base::Unretained(this), info)); |
|
Fady Samuel
2012/07/06 15:14:44
So are you sure you're delaying ACK'ing enough her
scshunt
2012/07/06 16:39:03
I was not, and that was the cause of the flicker.
|
| +} |
| + |
| void BrowserPlugin::PostMessage(const std::string& message, |
| const std::string& target_origin) { |
| fprintf(stderr, ">>>%s message: \"%s\"\n", __PRETTY_FUNCTION__, |
| message.c_str()); |
| } |
| +void BrowserPlugin::WillInitiatePaint() { |
| + for (std::vector< base::Callback<void(void)> >::const_iterator |
| + it = compositing_callbacks_.begin(); |
|
Fady Samuel
2012/07/06 15:14:44
Do we ever really expect to get multiple compositi
scshunt
2012/07/06 16:39:03
Not sure. It occurs to me that it would probably b
|
| + it != compositing_callbacks_.end(); ++it) { |
| + it->Run(); |
| + } |
| + compositing_callbacks_.clear(); |
| +} |
| + |
| +void BrowserPlugin::PerformBuffersSwappedACK(const BrowserPlugin_SwapInfo& info) { |
| + WebKit::WebView* webview = render_view_->webview(); |
| + DCHECK(webview); |
| + WebGraphicsContext3DCommandBufferImpl* buffer = static_cast<WebGraphicsContext3DCommandBufferImpl*>(webview->sharedGraphicsContext3D()); |
| + DCHECK(buffer); |
| + uint32 sync_point = buffer->insertSyncPoint(); |
| + render_view_->Send(new BrowserPluginHostMsg_BuffersSwappedACK(render_view_->GetRoutingID(), info, sync_point)); |
| + fprintf(stderr, "Sent browser plugin buffers swapped ACK\n"); |
| +} |
| + |
| WebKit::WebPluginContainer* BrowserPlugin::container() const { |
| return container_; |
| } |