Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/browser_plugin/old/browser_plugin.h" | 5 #include "content/renderer/browser_plugin/old/browser_plugin.h" |
| 6 | 6 |
| 7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/process.h" | 10 #include "base/process.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 plugin_(NULL) { | 76 plugin_(NULL) { |
| 77 id_ = ++g_next_id; | 77 id_ = ++g_next_id; |
| 78 Register(id_, this); | 78 Register(id_, this); |
| 79 | 79 |
| 80 // By default we do not navigate and simply stay with an | 80 // By default we do not navigate and simply stay with an |
| 81 // about:blank placeholder. | 81 // about:blank placeholder. |
| 82 std::string src; | 82 std::string src; |
| 83 ParseSrcAttribute("", &src); | 83 ParseSrcAttribute("", &src); |
| 84 | 84 |
| 85 if (!src.empty()) { | 85 if (!src.empty()) { |
| 86 render_view->Send(new BrowserPluginHostMsg_NavigateFromEmbedder( | 86 WebKit::WebView* web_view = render_view->webview(); |
|
Fady Samuel
2012/07/06 15:14:44
Given you're now applying changes to the new desig
| |
| 87 render_view->GetRoutingID(), | 87 if (web_view) { |
| 88 id_, | 88 WebGraphicsContext3DCommandBufferImpl* context = static_cast<WebGraphicsCo ntext3DCommandBufferImpl*>(web_view->sharedGraphicsContext3D()); |
| 89 frame->identifier(), | 89 DCHECK(context); |
| 90 src)); | 90 BrowserPluginHostMsg_Surface_Params params; |
| 91 params.gpu_process_id = context->GetGPUProcessID(); | |
| 92 params.client_id = context->GetChannelID(); | |
| 93 params.context_id = context->GetContextID(); | |
| 94 params.texture_id[0] = context->createTexture(); | |
| 95 params.texture_id[1] = context->createTexture(); | |
| 96 params.sync_point = context->insertSyncPoint(); | |
| 97 printf("Giving guest textures %u and %u\n", params.texture_id[0], params.t exture_id[1]); | |
| 98 render_view->Send(new BrowserPluginHostMsg_NavigateFromEmbedder( | |
| 99 render_view->GetRoutingID(), | |
| 100 id_, | |
| 101 frame->identifier(), | |
| 102 src, | |
| 103 params)); | |
| 104 } | |
| 91 } | 105 } |
| 92 } | 106 } |
| 93 | 107 |
| 94 BrowserPlugin::~BrowserPlugin() { | 108 BrowserPlugin::~BrowserPlugin() { |
| 95 Unregister(id_); | 109 Unregister(id_); |
| 96 } | 110 } |
| 97 | 111 |
| 98 void BrowserPlugin::ParseSrcAttribute( | 112 void BrowserPlugin::ParseSrcAttribute( |
| 99 const std::string& default_src, | 113 const std::string& default_src, |
| 100 std::string* src) { | 114 std::string* src) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 // TODO(fsamuel): We should delay the swapping out of the current plugin | 161 // TODO(fsamuel): We should delay the swapping out of the current plugin |
| 148 // until after the guest's WebGraphicsContext3D has been initialized. That | 162 // until after the guest's WebGraphicsContext3D has been initialized. That |
| 149 // way, we immediately have something to render onto the screen. | 163 // way, we immediately have something to render onto the screen. |
| 150 container->setPlugin(new_plugin); | 164 container->setPlugin(new_plugin); |
| 151 container->invalidate(); | 165 container->invalidate(); |
| 152 container->reportGeometry(); | 166 container->reportGeometry(); |
| 153 if (plugin_) | 167 if (plugin_) |
| 154 plugin_->destroy(); | 168 plugin_->destroy(); |
| 155 plugin_ = new_plugin; | 169 plugin_ = new_plugin; |
| 156 } | 170 } |
| OLD | NEW |