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 "ppapi/proxy/ppb_image_data_proxy.h" | 5 #include "ppapi/proxy/ppb_image_data_proxy.h" |
6 | 6 |
7 #include <string.h> // For memcpy | 7 #include <string.h> // For memcpy |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 } | 395 } |
396 | 396 |
397 SkCanvas* ImageData::GetCanvas() { | 397 SkCanvas* ImageData::GetCanvas() { |
398 #if defined(OS_NACL) | 398 #if defined(OS_NACL) |
399 return NULL; // No canvas in NaCl. | 399 return NULL; // No canvas in NaCl. |
400 #else | 400 #else |
401 return mapped_canvas_.get(); | 401 return mapped_canvas_.get(); |
402 #endif | 402 #endif |
403 } | 403 } |
404 | 404 |
| 405 void ImageData::SetUsedInReplaceContents() { |
| 406 used_in_replace_contents_ = true; |
| 407 } |
| 408 |
405 void ImageData::RecycleToPlugin(bool zero_contents) { | 409 void ImageData::RecycleToPlugin(bool zero_contents) { |
406 used_in_replace_contents_ = false; | 410 used_in_replace_contents_ = false; |
407 if (zero_contents) { | 411 if (zero_contents) { |
408 void* data = Map(); | 412 void* data = Map(); |
409 memset(data, 0, desc_.stride * desc_.size.height); | 413 memset(data, 0, desc_.stride * desc_.size.height); |
410 Unmap(); | 414 Unmap(); |
411 } | 415 } |
412 } | 416 } |
413 | 417 |
414 #if !defined(OS_NACL) | 418 #if !defined(OS_NACL) |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 // still cached in our process, the proxy still holds a reference so we can | 619 // still cached in our process, the proxy still holds a reference so we can |
616 // remove the one the renderer just sent is. If the proxy no longer holds a | 620 // remove the one the renderer just sent is. If the proxy no longer holds a |
617 // reference, we released everything and we should also release the one the | 621 // reference, we released everything and we should also release the one the |
618 // renderer just sent us. | 622 // renderer just sent us. |
619 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( | 623 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( |
620 API_ID_PPB_CORE, old_image_data)); | 624 API_ID_PPB_CORE, old_image_data)); |
621 } | 625 } |
622 | 626 |
623 } // namespace proxy | 627 } // namespace proxy |
624 } // namespace ppapi | 628 } // namespace ppapi |
OLD | NEW |