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

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

Issue 6899055: PPAPI: Force async callback invocation option. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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_io_trusted_thunk.cc ('k') | ppapi/thunk/ppb_file_system_thunk.cc » ('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) 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/dev/pp_file_info_dev.h" 5 #include "ppapi/c/dev/pp_file_info_dev.h"
6 #include "ppapi/c/dev/ppb_file_ref_dev.h" 6 #include "ppapi/c/dev/ppb_file_ref_dev.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/thunk/common.h"
10 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/thunk.h" 11 #include "ppapi/thunk/thunk.h"
10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/ppb_file_ref_api.h" 12 #include "ppapi/thunk/ppb_file_ref_api.h"
12 #include "ppapi/thunk/resource_creation_api.h" 13 #include "ppapi/thunk/resource_creation_api.h"
13 14
14 namespace ppapi { 15 namespace ppapi {
15 namespace thunk { 16 namespace thunk {
16 17
17 namespace { 18 namespace {
18 19
19 PP_Resource Create(PP_Resource file_system, const char* path) { 20 PP_Resource Create(PP_Resource file_system, const char* path) {
20 EnterFunctionGivenResource<ResourceCreationAPI> enter(file_system, true); 21 EnterFunctionGivenResource<ResourceCreationAPI> enter(file_system, true);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (enter.failed()) 55 if (enter.failed())
55 return PP_ERROR_BADRESOURCE; 56 return PP_ERROR_BADRESOURCE;
56 return enter.object()->GetParent(); 57 return enter.object()->GetParent();
57 } 58 }
58 59
59 int32_t MakeDirectory(PP_Resource directory_ref, 60 int32_t MakeDirectory(PP_Resource directory_ref,
60 PP_Bool make_ancestors, 61 PP_Bool make_ancestors,
61 PP_CompletionCallback callback) { 62 PP_CompletionCallback callback) {
62 EnterResource<PPB_FileRef_API> enter(directory_ref, true); 63 EnterResource<PPB_FileRef_API> enter(directory_ref, true);
63 if (enter.failed()) 64 if (enter.failed())
64 return PP_ERROR_BADRESOURCE; 65 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
65 return enter.object()->MakeDirectory(make_ancestors, callback); 66 int32_t result = enter.object()->MakeDirectory(make_ancestors, callback);
67 return MayForceCallback(callback, result);
66 } 68 }
67 69
68 int32_t Touch(PP_Resource file_ref, 70 int32_t Touch(PP_Resource file_ref,
69 PP_Time last_access_time, 71 PP_Time last_access_time,
70 PP_Time last_modified_time, 72 PP_Time last_modified_time,
71 PP_CompletionCallback callback) { 73 PP_CompletionCallback callback) {
72 EnterResource<PPB_FileRef_API> enter(file_ref, true); 74 EnterResource<PPB_FileRef_API> enter(file_ref, true);
73 if (enter.failed()) 75 if (enter.failed())
74 return PP_ERROR_BADRESOURCE; 76 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
75 return enter.object()->Touch(last_access_time, last_modified_time, callback); 77 int32_t result = enter.object()->Touch(last_access_time, last_modified_time,
78 callback);
79 return MayForceCallback(callback, result);
76 } 80 }
77 81
78 int32_t Delete(PP_Resource file_ref, 82 int32_t Delete(PP_Resource file_ref,
79 PP_CompletionCallback callback) { 83 PP_CompletionCallback callback) {
80 EnterResource<PPB_FileRef_API> enter(file_ref, true); 84 EnterResource<PPB_FileRef_API> enter(file_ref, true);
81 if (enter.failed()) 85 if (enter.failed())
82 return PP_ERROR_BADRESOURCE; 86 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
83 return enter.object()->Delete(callback); 87 int32_t result = enter.object()->Delete(callback);
88 return MayForceCallback(callback, result);
84 } 89 }
85 90
86 int32_t Rename(PP_Resource file_ref, 91 int32_t Rename(PP_Resource file_ref,
87 PP_Resource new_file_ref, 92 PP_Resource new_file_ref,
88 PP_CompletionCallback callback) { 93 PP_CompletionCallback callback) {
89 EnterResource<PPB_FileRef_API> enter(file_ref, true); 94 EnterResource<PPB_FileRef_API> enter(file_ref, true);
90 if (enter.failed()) 95 if (enter.failed())
91 return PP_ERROR_BADRESOURCE; 96 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
92 return enter.object()->Rename(new_file_ref, callback); 97 int32_t result = enter.object()->Rename(new_file_ref, callback);
98 return MayForceCallback(callback, result);
93 } 99 }
94 100
95 const PPB_FileRef_Dev g_ppb_file_ref_thunk = { 101 const PPB_FileRef_Dev g_ppb_file_ref_thunk = {
96 &Create, 102 &Create,
97 &IsFileRef, 103 &IsFileRef,
98 &GetFileSystemType, 104 &GetFileSystemType,
99 &GetName, 105 &GetName,
100 &GetPath, 106 &GetPath,
101 &GetParent, 107 &GetParent,
102 &MakeDirectory, 108 &MakeDirectory,
103 &Touch, 109 &Touch,
104 &Delete, 110 &Delete,
105 &Rename 111 &Rename
106 }; 112 };
107 113
108 } // namespace 114 } // namespace
109 115
110 const PPB_FileRef_Dev* GetPPB_FileRef_Thunk() { 116 const PPB_FileRef_Dev* GetPPB_FileRef_Thunk() {
111 return &g_ppb_file_ref_thunk; 117 return &g_ppb_file_ref_thunk;
112 } 118 }
113 119
114 } // namespace thunk 120 } // namespace thunk
115 } // namespace ppapi 121 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_file_io_trusted_thunk.cc ('k') | ppapi/thunk/ppb_file_system_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698