| 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/c/pp_completion_callback.h" | 5 #include "ppapi/c/pp_completion_callback.h" |
| 6 #include "ppapi/c/pp_errors.h" | 6 #include "ppapi/c/pp_errors.h" |
| 7 #include "ppapi/c/ppb_graphics_2d.h" | 7 #include "ppapi/c/ppb_graphics_2d.h" |
| 8 #include "ppapi/thunk/common.h" |
| 8 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
| 9 #include "ppapi/thunk/ppb_graphics_2d_api.h" | 10 #include "ppapi/thunk/ppb_graphics_2d_api.h" |
| 10 #include "ppapi/thunk/resource_creation_api.h" | 11 #include "ppapi/thunk/resource_creation_api.h" |
| 11 | 12 |
| 12 namespace ppapi { | 13 namespace ppapi { |
| 13 namespace thunk { | 14 namespace thunk { |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 PP_Resource Create(PP_Instance instance, | 18 PP_Resource Create(PP_Instance instance, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 EnterResource<PPB_Graphics2D_API> enter(graphics_2d, true); | 65 EnterResource<PPB_Graphics2D_API> enter(graphics_2d, true); |
| 65 if (enter.failed()) | 66 if (enter.failed()) |
| 66 return; | 67 return; |
| 67 enter.object()->ReplaceContents(image_data); | 68 enter.object()->ReplaceContents(image_data); |
| 68 } | 69 } |
| 69 | 70 |
| 70 int32_t Flush(PP_Resource graphics_2d, | 71 int32_t Flush(PP_Resource graphics_2d, |
| 71 PP_CompletionCallback callback) { | 72 PP_CompletionCallback callback) { |
| 72 EnterResource<PPB_Graphics2D_API> enter(graphics_2d, true); | 73 EnterResource<PPB_Graphics2D_API> enter(graphics_2d, true); |
| 73 if (enter.failed()) | 74 if (enter.failed()) |
| 74 return PP_ERROR_BADRESOURCE; | 75 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); |
| 75 return enter.object()->Flush(callback); | 76 int32_t result = enter.object()->Flush(callback); |
| 77 return MayForceCallback(callback, result); |
| 76 } | 78 } |
| 77 | 79 |
| 78 const PPB_Graphics2D g_ppb_graphics_2d_thunk = { | 80 const PPB_Graphics2D g_ppb_graphics_2d_thunk = { |
| 79 &Create, | 81 &Create, |
| 80 &IsGraphics2D, | 82 &IsGraphics2D, |
| 81 &Describe, | 83 &Describe, |
| 82 &PaintImageData, | 84 &PaintImageData, |
| 83 &Scroll, | 85 &Scroll, |
| 84 &ReplaceContents, | 86 &ReplaceContents, |
| 85 &Flush | 87 &Flush |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 } // namespace | 90 } // namespace |
| 89 | 91 |
| 90 const PPB_Graphics2D* GetPPB_Graphics2D_Thunk() { | 92 const PPB_Graphics2D* GetPPB_Graphics2D_Thunk() { |
| 91 return &g_ppb_graphics_2d_thunk; | 93 return &g_ppb_graphics_2d_thunk; |
| 92 } | 94 } |
| 93 | 95 |
| 94 } // namespace thunk | 96 } // namespace thunk |
| 95 } // namespace ppapi | 97 } // namespace ppapi |
| OLD | NEW |