OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/cpp/dev/buffer_dev.h" | 5 #include "ppapi/cpp/dev/buffer_dev.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_buffer_dev.h" | 7 #include "ppapi/c/dev/ppb_buffer_dev.h" |
8 #include "ppapi/cpp/instance_handle.h" | 8 #include "ppapi/cpp/instance_handle.h" |
9 #include "ppapi/cpp/module.h" | 9 #include "ppapi/cpp/module.h" |
10 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 Init(); | 57 Init(); |
58 return *this; | 58 return *this; |
59 } | 59 } |
60 | 60 |
61 void Buffer_Dev::Init() { | 61 void Buffer_Dev::Init() { |
62 if (get_interface<PPB_Buffer_Dev>()->Describe(pp_resource(), &size_)) { | 62 if (get_interface<PPB_Buffer_Dev>()->Describe(pp_resource(), &size_)) { |
63 data_ = get_interface<PPB_Buffer_Dev>()->Map(pp_resource()); | 63 data_ = get_interface<PPB_Buffer_Dev>()->Map(pp_resource()); |
64 if (data_) | 64 if (data_) |
65 return; | 65 return; |
66 } | 66 } |
| 67 |
| 68 Clear(); |
67 data_ = NULL; | 69 data_ = NULL; |
68 size_ = 0; | 70 size_ = 0; |
69 } | 71 } |
70 | 72 |
71 } // namespace pp | 73 } // namespace pp |
OLD | NEW |