OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ppapi/proxy/truetype_font_resource.h" | 5 #include "ppapi/proxy/truetype_font_resource.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ipc/ipc_message.h" | 8 #include "ipc/ipc_message.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 TrueTypeFontResource::~TrueTypeFontResource() { | 38 TrueTypeFontResource::~TrueTypeFontResource() { |
39 } | 39 } |
40 | 40 |
41 PPB_TrueTypeFont_API* TrueTypeFontResource::AsPPB_TrueTypeFont_API() { | 41 PPB_TrueTypeFont_API* TrueTypeFontResource::AsPPB_TrueTypeFont_API() { |
42 return this; | 42 return this; |
43 } | 43 } |
44 | 44 |
45 int32_t TrueTypeFontResource::Describe( | 45 int32_t TrueTypeFontResource::Describe( |
46 PP_TrueTypeFontDesc_Dev* desc, | 46 PP_TrueTypeFontDesc_Dev* desc, |
47 scoped_refptr<TrackedCallback> callback) { | 47 scoped_refptr<TrackedCallback> callback) { |
48 if (describe_callback_) | 48 if (describe_callback_.get()) |
49 return PP_ERROR_INPROGRESS; | 49 return PP_ERROR_INPROGRESS; |
50 | 50 |
51 if (create_result_ == PP_OK) { | 51 if (create_result_ == PP_OK) { |
52 desc_.CopyToPPTrueTypeFontDesc(desc); | 52 desc_.CopyToPPTrueTypeFontDesc(desc); |
53 } else if (create_result_ == PP_OK_COMPLETIONPENDING) { | 53 } else if (create_result_ == PP_OK_COMPLETIONPENDING) { |
54 describe_desc_ = desc; | 54 describe_desc_ = desc; |
55 describe_callback_ = callback; | 55 describe_callback_ = callback; |
56 } | 56 } |
57 | 57 |
58 return create_result_; | 58 return create_result_; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 if (output.is_valid()) | 155 if (output.is_valid()) |
156 output.StoreArray(data.data(), std::max(0, result)); | 156 output.StoreArray(data.data(), std::max(0, result)); |
157 else | 157 else |
158 result = PP_ERROR_FAILED; | 158 result = PP_ERROR_FAILED; |
159 | 159 |
160 callback->Run(result); | 160 callback->Run(result); |
161 } | 161 } |
162 | 162 |
163 } // namespace proxy | 163 } // namespace proxy |
164 } // namespace ppapi | 164 } // namespace ppapi |
OLD | NEW |