OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/resource_converter.h" | 5 #include "content/renderer/pepper/resource_converter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "content/public/renderer/renderer_ppapi_host.h" | 9 #include "content/public/renderer/renderer_ppapi_host.h" |
10 #include "content/renderer/pepper/pepper_file_system_host.h" | 10 #include "content/renderer/pepper/pepper_file_system_host.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 *was_resource = true; | 259 *was_resource = true; |
260 return true; | 260 return true; |
261 } | 261 } |
262 | 262 |
263 // The value was not convertible to a resource. Return true with | 263 // The value was not convertible to a resource. Return true with |
264 // |was_resource| set to false. As per the interface of FromV8Value, |result| | 264 // |was_resource| set to false. As per the interface of FromV8Value, |result| |
265 // may be left unmodified in this case. | 265 // may be left unmodified in this case. |
266 return true; | 266 return true; |
267 } | 267 } |
268 | 268 |
| 269 void ResourceConverterImpl::Reset() { |
| 270 browser_host_create_messages_.clear(); |
| 271 browser_vars_.clear(); |
| 272 } |
| 273 |
| 274 bool ResourceConverterImpl::NeedsFlush() { |
| 275 return !browser_host_create_messages_.empty(); |
| 276 } |
| 277 |
269 void ResourceConverterImpl::Flush(const base::Callback<void(bool)>& callback) { | 278 void ResourceConverterImpl::Flush(const base::Callback<void(bool)>& callback) { |
270 host_->CreateBrowserResourceHosts( | 279 host_->CreateBrowserResourceHosts( |
271 instance_, | 280 instance_, |
272 browser_host_create_messages_, | 281 browser_host_create_messages_, |
273 base::Bind(&FlushComplete, callback, browser_vars_)); | 282 base::Bind(&FlushComplete, callback, browser_vars_)); |
274 browser_host_create_messages_.clear(); | 283 browser_host_create_messages_.clear(); |
275 browser_vars_.clear(); | 284 browser_vars_.clear(); |
276 } | 285 } |
277 | 286 |
278 bool ResourceConverterImpl::ToV8Value(const PP_Var& var, | 287 bool ResourceConverterImpl::ToV8Value(const PP_Var& var, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 const IPC::Message& create_message, | 344 const IPC::Message& create_message, |
336 const IPC::Message& browser_host_create_message) { | 345 const IPC::Message& browser_host_create_message) { |
337 scoped_refptr<HostResourceVar> result = | 346 scoped_refptr<HostResourceVar> result = |
338 CreateResourceVar(pending_renderer_id, create_message); | 347 CreateResourceVar(pending_renderer_id, create_message); |
339 browser_host_create_messages_.push_back(browser_host_create_message); | 348 browser_host_create_messages_.push_back(browser_host_create_message); |
340 browser_vars_.push_back(result); | 349 browser_vars_.push_back(result); |
341 return result; | 350 return result; |
342 } | 351 } |
343 | 352 |
344 } // namespace content | 353 } // namespace content |
OLD | NEW |