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

Side by Side Diff: native_client_sdk/src/doc/devguide/coding/file-io.rst

Issue 254033002: [NaCl SDK Docs] Remove links to developers.google.com (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 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
OLDNEW
1 .. _devguide-coding-fileio: 1 .. _devguide-coding-fileio:
2 2
3 ######## 3 ########
4 File I/O 4 File I/O
5 ######## 5 ########
6 6
7 .. contents:: 7 .. contents::
8 :local: 8 :local:
9 :backlinks: none 9 :backlinks: none
10 :depth: 2 10 :depth: 2
11 11
12 Introduction 12 Introduction
13 ============ 13 ============
14 14
15 This chapter describes how to use the `FileIO API 15 This chapter describes how to use the `FileIO API
16 <https://developers.google.com/native-client/peppercpp/classpp_1_1_file_i_o>`_ 16 </native-client/pepper_stable/cpp/classpp_1_1_file_i_o>`_ to read and write
17 to read and write files using a local secure data store. 17 files using a local secure data store.
18 18
19 You might use the File IO API with the URL Loading APIs to create an overall 19 You might use the File IO API with the URL Loading APIs to create an overall
20 data download and caching solution for your NaCl applications. For example: 20 data download and caching solution for your NaCl applications. For example:
21 21
22 #. Use the File IO APIs to check the local disk to see if a file exists that 22 #. Use the File IO APIs to check the local disk to see if a file exists that
23 your program needs. 23 your program needs.
24 #. If the file exists locally, load it into memory using the File IO API. If 24 #. If the file exists locally, load it into memory using the File IO API. If
25 the file doesn't exist locally, use the URL Loading API to retrieve the 25 the file doesn't exist locally, use the URL Loading API to retrieve the
26 file from the server. 26 file from the server.
27 #. Use the File IO API to write the file to disk. 27 #. Use the File IO API to write the file to disk.
28 #. Load the file into memory using the File IO API when needed by your 28 #. Load the file into memory using the File IO API when needed by your
29 application. 29 application.
30 30
31 The example discussed in this chapter is included in the SDK in the directory 31 The example discussed in this chapter is included in the SDK in the directory
32 ``examples/api/file_io``. 32 ``examples/api/file_io``.
33 33
34 Reference information 34 Reference information
35 ===================== 35 =====================
36 36
37 For reference information related to FileIO, see the following documentation: 37 For reference information related to FileIO, see the following documentation:
38 38
39 * `file_io.h 39 * `file_io.h </native-client/pepper_stable/cpp/file__io_8h>`_ - API to create a
40 <https://developers.google.com/native-client/peppercpp/file__io_8h>`_ - API 40 FileIO object
41 to create a FileIO object 41 * `file_ref.h </native-client/pepper_stable/cpp/file__ref_8h>`_ - API to create
42 * `file_ref.h 42 a file reference or "weak pointer" to a file in a file system
43 <https://developers.google.com/native-client/peppercpp/file__ref_8h>`_ - API 43 * `file_system.h </native-client/pepper_stable/cpp/file__system_8h>`_ - API to
44 to create a file reference or "weak pointer" to a file in a file system 44 create a file system associated with a file
45 * `file_system.h
46 <https://developers.google.com/native-client/peppercpp/file__system_8h>`_ -
47 API to create a file system associated with a file
48 45
49 Local file I/O 46 Local file I/O
50 ============== 47 ==============
51 48
52 Chrome provides an obfuscated, restricted area on disk to which a web app can 49 Chrome provides an obfuscated, restricted area on disk to which a web app can
53 safely `read and write files 50 safely `read and write files
54 <https://developers.google.com/chrome/whitepapers/storage#persistent>`_. The 51 <https://developers.google.com/chrome/whitepapers/storage#persistent>`_. The
55 Pepper FileIO, FileRef, and FileSystem APIs (collectively called the File IO 52 Pepper FileIO, FileRef, and FileSystem APIs (collectively called the File IO
56 APIs) allow you to access this sandboxed local disk so you can read and write 53 APIs) allow you to access this sandboxed local disk so you can read and write
57 files and manage caching yourself. The data is persistent between launches of 54 files and manage caching yourself. The data is persistent between launches of
58 Chrome, and is not removed unless your application deletes it or the user 55 Chrome, and is not removed unless your application deletes it or the user
59 manually deletes it. There is no limit to the amount of local data you can 56 manually deletes it. There is no limit to the amount of local data you can
60 use, other than the actual space available on the local drive. 57 use, other than the actual space available on the local drive.
61 58
62 .. _quota_management: 59 .. _quota_management:
63 .. _enabling_file_access: 60 .. _enabling_file_access:
64 61
65 Enabling local file I/O 62 Enabling local file I/O
66 ----------------------- 63 -----------------------
67 64
68 The easiest way to enable the writing of persistent local data is to include 65 The easiest way to enable the writing of persistent local data is to include
69 the `unlimitedStorage permission 66 the `unlimitedStorage permission
70 <http://developer.chrome.com/extensions/declare_permissions.html#unlimitedStorag e>`_ 67 </extensions/declare_permissions#unlimitedStorage>`_ in your Chrome Web Store
71 in your Chrome Web Store manifest file. With this permission you can use the 68 manifest file. With this permission you can use the Pepper FileIO API without
72 Pepper FileIO API without the need to request disk space at run time. When 69 the need to request disk space at run time. When the user installs the app
73 the user installs the app Chrome displays a message announcing that the app 70 Chrome displays a message announcing that the app writes to the local disk.
74 writes to the local disk.
75 71
76 If you do not use the ``unlimitedStorage`` permission you must include 72 If you do not use the ``unlimitedStorage`` permission you must include
77 JavaScript code that calls the `HTML5 Quota Management API 73 JavaScript code that calls the `HTML5 Quota Management API
78 <http://updates.html5rocks.com/2011/11/Quota-Management-API-Fast-Facts>`_ to 74 <http://updates.html5rocks.com/2011/11/Quota-Management-API-Fast-Facts>`_ to
79 explicitly request local disk space before using the FileIO API. In this case 75 explicitly request local disk space before using the FileIO API. In this case
80 Chrome will prompt the user to accept a requestQuota call every time one is 76 Chrome will prompt the user to accept a requestQuota call every time one is
81 made. 77 made.
82 78
83 Testing local file I/O 79 Testing local file I/O
84 ---------------------- 80 ----------------------
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 544
549 .. naclcode:: 545 .. naclcode::
550 546
551 int32_t result = ref.MakeDirectory( 547 int32_t result = ref.MakeDirectory(
552 PP_MAKEDIRECTORYFLAG_NONE, pp::BlockUntilComplete()); 548 PP_MAKEDIRECTORYFLAG_NONE, pp::BlockUntilComplete());
553 if (result != PP_OK) { 549 if (result != PP_OK) {
554 ShowErrorMessage("Make directory failed", result); 550 ShowErrorMessage("Make directory failed", result);
555 return; 551 return;
556 } 552 }
557 ShowStatusMessage("Make directory success"); 553 ShowStatusMessage("Make directory success");
OLDNEW
« no previous file with comments | « native_client_sdk/src/doc/devguide/coding/audio.rst ('k') | native_client_sdk/src/doc/devguide/coding/message-system.rst » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698