Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Side by Side Diff: ppapi/thunk/ppb_file_ref_thunk.cc

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: export AssertLockHeld Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/thunk/ppb_file_ref_api.h ('k') | ppapi/thunk/ppb_file_system_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/c/pp_file_info.h" 5 #include "ppapi/c/pp_file_info.h"
6 #include "ppapi/c/ppb_file_ref.h" 6 #include "ppapi/c/ppb_file_ref.h"
7 #include "ppapi/c/pp_completion_callback.h" 7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/private/ppb_file_ref_private.h" 9 #include "ppapi/c/private/ppb_file_ref_private.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
10 #include "ppapi/thunk/enter.h" 11 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/thunk.h" 12 #include "ppapi/thunk/thunk.h"
12 #include "ppapi/thunk/ppb_file_ref_api.h" 13 #include "ppapi/thunk/ppb_file_ref_api.h"
13 #include "ppapi/thunk/resource_creation_api.h" 14 #include "ppapi/thunk/resource_creation_api.h"
14 15
15 namespace ppapi { 16 namespace ppapi {
16 namespace thunk { 17 namespace thunk {
17 18
18 namespace { 19 namespace {
19 20
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return enter.object()->GetParent(); 64 return enter.object()->GetParent();
64 } 65 }
65 66
66 int32_t MakeDirectory(PP_Resource directory_ref, 67 int32_t MakeDirectory(PP_Resource directory_ref,
67 PP_Bool make_ancestors, 68 PP_Bool make_ancestors,
68 PP_CompletionCallback callback) { 69 PP_CompletionCallback callback) {
69 EnterFileRef enter(directory_ref, callback, true); 70 EnterFileRef enter(directory_ref, callback, true);
70 if (enter.failed()) 71 if (enter.failed())
71 return enter.retval(); 72 return enter.retval();
72 return enter.SetResult(enter.object()->MakeDirectory(make_ancestors, 73 return enter.SetResult(enter.object()->MakeDirectory(make_ancestors,
73 callback)); 74 enter.callback()));
74 } 75 }
75 76
76 int32_t Touch(PP_Resource file_ref, 77 int32_t Touch(PP_Resource file_ref,
77 PP_Time last_access_time, 78 PP_Time last_access_time,
78 PP_Time last_modified_time, 79 PP_Time last_modified_time,
79 PP_CompletionCallback callback) { 80 PP_CompletionCallback callback) {
80 EnterFileRef enter(file_ref, callback, true); 81 EnterFileRef enter(file_ref, callback, true);
81 if (enter.failed()) 82 if (enter.failed())
82 return enter.retval(); 83 return enter.retval();
83 return enter.SetResult(enter.object()->Touch( 84 return enter.SetResult(enter.object()->Touch(
84 last_access_time, last_modified_time, callback)); 85 last_access_time, last_modified_time, enter.callback()));
85 } 86 }
86 87
87 int32_t Delete(PP_Resource file_ref, 88 int32_t Delete(PP_Resource file_ref,
88 PP_CompletionCallback callback) { 89 PP_CompletionCallback callback) {
89 EnterFileRef enter(file_ref, callback, true); 90 EnterFileRef enter(file_ref, callback, true);
90 if (enter.failed()) 91 if (enter.failed())
91 return enter.retval(); 92 return enter.retval();
92 return enter.SetResult(enter.object()->Delete(callback)); 93 return enter.SetResult(enter.object()->Delete(enter.callback()));
93 } 94 }
94 95
95 int32_t Rename(PP_Resource file_ref, 96 int32_t Rename(PP_Resource file_ref,
96 PP_Resource new_file_ref, 97 PP_Resource new_file_ref,
97 PP_CompletionCallback callback) { 98 PP_CompletionCallback callback) {
98 EnterFileRef enter(file_ref, callback, true); 99 EnterFileRef enter(file_ref, callback, true);
99 if (enter.failed()) 100 if (enter.failed())
100 return enter.retval(); 101 return enter.retval();
101 return enter.SetResult(enter.object()->Rename(new_file_ref, callback)); 102 return enter.SetResult(enter.object()->Rename(new_file_ref,
103 enter.callback()));
102 } 104 }
103 105
104 PP_Var GetAbsolutePath(PP_Resource file_ref) { 106 PP_Var GetAbsolutePath(PP_Resource file_ref) {
105 EnterFileRef enter(file_ref, true); 107 EnterFileRef enter(file_ref, true);
106 if (enter.failed()) 108 if (enter.failed())
107 return PP_MakeUndefined(); 109 return PP_MakeUndefined();
108 return enter.object()->GetAbsolutePath(); 110 return enter.object()->GetAbsolutePath();
109 } 111 }
110 112
111 const PPB_FileRef g_ppb_file_ref_thunk = { 113 const PPB_FileRef g_ppb_file_ref_thunk = {
(...skipping 18 matching lines...) Expand all
130 const PPB_FileRef_1_0* GetPPB_FileRef_1_0_Thunk() { 132 const PPB_FileRef_1_0* GetPPB_FileRef_1_0_Thunk() {
131 return &g_ppb_file_ref_thunk; 133 return &g_ppb_file_ref_thunk;
132 } 134 }
133 135
134 const PPB_FileRefPrivate_0_1* GetPPB_FileRefPrivate_0_1_Thunk() { 136 const PPB_FileRefPrivate_0_1* GetPPB_FileRefPrivate_0_1_Thunk() {
135 return &g_ppb_file_ref_private_thunk; 137 return &g_ppb_file_ref_private_thunk;
136 } 138 }
137 139
138 } // namespace thunk 140 } // namespace thunk
139 } // namespace ppapi 141 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_file_ref_api.h ('k') | ppapi/thunk/ppb_file_system_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698