Add an exponential backoff to rechecking the app list doodle.
[chromium-blink-merge.git] / ppapi / thunk / ppb_file_system_thunk.cc
blob9a3dfd5842c8af3aaee702a4e8291cb2c15cc602
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
3 // found in the LICENSE file.
5 // From ppb_file_system.idl modified Wed May 15 13:57:07 2013.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_file_system.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h"
13 #include "ppapi/thunk/ppb_file_system_api.h"
15 namespace ppapi {
16 namespace thunk {
18 namespace {
20 PP_Resource Create(PP_Instance instance, PP_FileSystemType type) {
21 VLOG(4) << "PPB_FileSystem::Create()";
22 EnterResourceCreation enter(instance);
23 if (enter.failed())
24 return 0;
25 return enter.functions()->CreateFileSystem(instance, type);
28 PP_Bool IsFileSystem(PP_Resource resource) {
29 VLOG(4) << "PPB_FileSystem::IsFileSystem()";
30 EnterResource<PPB_FileSystem_API> enter(resource, false);
31 return PP_FromBool(enter.succeeded());
34 int32_t Open(PP_Resource file_system,
35 int64_t expected_size,
36 struct PP_CompletionCallback callback) {
37 VLOG(4) << "PPB_FileSystem::Open()";
38 EnterResource<PPB_FileSystem_API> enter(file_system, callback, true);
39 if (enter.failed())
40 return enter.retval();
41 return enter.SetResult(enter.object()->Open(expected_size, enter.callback()));
44 PP_FileSystemType GetType(PP_Resource file_system) {
45 VLOG(4) << "PPB_FileSystem::GetType()";
46 EnterResource<PPB_FileSystem_API> enter(file_system, true);
47 if (enter.failed())
48 return PP_FILESYSTEMTYPE_INVALID;
49 return enter.object()->GetType();
52 const PPB_FileSystem_1_0 g_ppb_filesystem_thunk_1_0 = {&Create,
53 &IsFileSystem,
54 &Open,
55 &GetType};
57 } // namespace
59 PPAPI_THUNK_EXPORT const PPB_FileSystem_1_0* GetPPB_FileSystem_1_0_Thunk() {
60 return &g_ppb_filesystem_thunk_1_0;
63 } // namespace thunk
64 } // namespace ppapi