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/pepper/renderer_ppapi_host_impl.h" | 5 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 } | 255 } |
| 256 | 256 |
| 257 void RendererPpapiHostImpl::CreateBrowserResourceHosts( | 257 void RendererPpapiHostImpl::CreateBrowserResourceHosts( |
| 258 PP_Instance instance, | 258 PP_Instance instance, |
| 259 const std::vector<IPC::Message>& nested_msgs, | 259 const std::vector<IPC::Message>& nested_msgs, |
| 260 const base::Callback<void(const std::vector<int>&)>& callback) const { | 260 const base::Callback<void(const std::vector<int>&)>& callback) const { |
| 261 RenderFrame* render_frame = GetRenderFrameForInstance(instance); | 261 RenderFrame* render_frame = GetRenderFrameForInstance(instance); |
| 262 PepperBrowserConnection* browser_connection = | 262 PepperBrowserConnection* browser_connection = |
| 263 PepperBrowserConnection::Get(render_frame); | 263 PepperBrowserConnection::Get(render_frame); |
| 264 if (!browser_connection) { | 264 if (!browser_connection) { |
| 265 base::ThreadTaskRunnerHandle::Get()->PostTask( | 265 render_frame->GetLoadingTaskRunner()->PostTask( |
|
alex clarke (OOO till 29th)
2017/01/23 11:37:05
So in theory I think that's a reasonable change. T
| |
| 266 FROM_HERE, | 266 FROM_HERE, |
| 267 base::Bind(callback, std::vector<int>(nested_msgs.size(), 0))); | 267 base::Bind(callback, std::vector<int>(nested_msgs.size(), 0))); |
| 268 } else { | 268 } else { |
| 269 browser_connection->SendBrowserCreate( | 269 browser_connection->SendBrowserCreate( |
| 270 module_->GetPluginChildId(), instance, nested_msgs, callback); | 270 module_->GetPluginChildId(), instance, nested_msgs, callback); |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 | 273 |
| 274 GURL RendererPpapiHostImpl::GetDocumentURL(PP_Instance pp_instance) const { | 274 GURL RendererPpapiHostImpl::GetDocumentURL(PP_Instance pp_instance) const { |
| 275 PepperPluginInstanceImpl* instance = GetAndValidateInstance(pp_instance); | 275 PepperPluginInstanceImpl* instance = GetAndValidateInstance(pp_instance); |
| 276 if (!instance) | 276 if (!instance) |
| 277 return GURL(); | 277 return GURL(); |
| 278 return instance->document_url(); | 278 return instance->document_url(); |
| 279 } | 279 } |
| 280 | 280 |
| 281 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance( | 281 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance( |
| 282 PP_Instance pp_instance) const { | 282 PP_Instance pp_instance) const { |
| 283 PepperPluginInstanceImpl* instance = | 283 PepperPluginInstanceImpl* instance = |
| 284 HostGlobals::Get()->GetInstance(pp_instance); | 284 HostGlobals::Get()->GetInstance(pp_instance); |
| 285 if (!instance) | 285 if (!instance) |
| 286 return NULL; | 286 return NULL; |
| 287 if (!instance->IsValidInstanceOf(module_)) | 287 if (!instance->IsValidInstanceOf(module_)) |
| 288 return NULL; | 288 return NULL; |
| 289 return instance; | 289 return instance; |
| 290 } | 290 } |
| 291 | 291 |
| 292 } // namespace content | 292 } // namespace content |
| OLD | NEW |