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

Side by Side Diff: ppapi/thunk/ppb_file_system_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_ref_thunk.cc ('k') | ppapi/thunk/ppb_flash_menu_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/ppb_file_system_dev.h" 5 #include "ppapi/c/dev/ppb_file_system_dev.h"
6 #include "ppapi/c/pp_completion_callback.h" 6 #include "ppapi/c/pp_completion_callback.h"
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/thunk/common.h"
9 #include "ppapi/thunk/enter.h"
8 #include "ppapi/thunk/thunk.h" 10 #include "ppapi/thunk/thunk.h"
9 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/ppb_file_system_api.h" 11 #include "ppapi/thunk/ppb_file_system_api.h"
11 #include "ppapi/thunk/resource_creation_api.h" 12 #include "ppapi/thunk/resource_creation_api.h"
12 13
13 namespace ppapi { 14 namespace ppapi {
14 namespace thunk { 15 namespace thunk {
15 16
16 namespace { 17 namespace {
17 18
18 PP_Resource Create(PP_Instance instance, PP_FileSystemType_Dev type) { 19 PP_Resource Create(PP_Instance instance, PP_FileSystemType_Dev type) {
19 EnterFunction<ResourceCreationAPI> enter(instance, true); 20 EnterFunction<ResourceCreationAPI> enter(instance, true);
20 if (enter.failed()) 21 if (enter.failed())
21 return 0; 22 return 0;
22 return enter.functions()->CreateFileSystem(instance, type); 23 return enter.functions()->CreateFileSystem(instance, type);
23 } 24 }
24 25
25 PP_Bool IsFileSystem(PP_Resource resource) { 26 PP_Bool IsFileSystem(PP_Resource resource) {
26 EnterResource<PPB_FileSystem_API> enter(resource, false); 27 EnterResource<PPB_FileSystem_API> enter(resource, false);
27 return PP_FromBool(enter.succeeded()); 28 return PP_FromBool(enter.succeeded());
28 } 29 }
29 30
30 int32_t Open(PP_Resource file_system, 31 int32_t Open(PP_Resource file_system,
31 int64 expected_size, 32 int64 expected_size,
32 PP_CompletionCallback callback) { 33 PP_CompletionCallback callback) {
33 EnterResource<PPB_FileSystem_API> enter(file_system, true); 34 EnterResource<PPB_FileSystem_API> enter(file_system, true);
34 if (enter.failed()) 35 if (enter.failed())
35 return PP_ERROR_BADRESOURCE; 36 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
36 return enter.object()->Open(expected_size, callback); 37 int32_t result = enter.object()->Open(expected_size, callback);
38 return MayForceCallback(callback, result);
37 } 39 }
38 40
39 PP_FileSystemType_Dev GetType(PP_Resource file_system) { 41 PP_FileSystemType_Dev GetType(PP_Resource file_system) {
40 EnterResource<PPB_FileSystem_API> enter(file_system, true); 42 EnterResource<PPB_FileSystem_API> enter(file_system, true);
41 if (enter.failed()) 43 if (enter.failed())
42 return PP_FILESYSTEMTYPE_INVALID; 44 return PP_FILESYSTEMTYPE_INVALID;
43 return enter.object()->GetType(); 45 return enter.object()->GetType();
44 } 46 }
45 47
46 const PPB_FileSystem_Dev g_ppb_file_system_thunk = { 48 const PPB_FileSystem_Dev g_ppb_file_system_thunk = {
47 &Create, 49 &Create,
48 &IsFileSystem, 50 &IsFileSystem,
49 &Open, 51 &Open,
50 &GetType 52 &GetType
51 }; 53 };
52 54
53 } // namespace 55 } // namespace
54 56
55 const PPB_FileSystem_Dev* GetPPB_FileSystem_Thunk() { 57 const PPB_FileSystem_Dev* GetPPB_FileSystem_Thunk() {
56 return &g_ppb_file_system_thunk; 58 return &g_ppb_file_system_thunk;
57 } 59 }
58 60
59 } // namespace thunk 61 } // namespace thunk
60 } // namespace ppapi 62 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_file_ref_thunk.cc ('k') | ppapi/thunk/ppb_flash_menu_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698