summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/completion_callback.h
diff options
context:
space:
mode:
authorjvoung@chromium.org <jvoung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-17 21:07:09 +0000
committerjvoung@chromium.org <jvoung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-17 21:07:09 +0000
commitefb69bec8c15853f4b0ed7afcdeb32718563bba4 (patch)
tree74a9ab13c80fbcf1297bdc05b0d521b5a5984804 /ppapi/cpp/completion_callback.h
parentcd86bca4469548da1ffc93238bf50b572304dac0 (diff)
downloadchromium_src-efb69bec8c15853f4b0ed7afcdeb32718563bba4.zip
chromium_src-efb69bec8c15853f4b0ed7afcdeb32718563bba4.tar.gz
chromium_src-efb69bec8c15853f4b0ed7afcdeb32718563bba4.tar.bz2
Use HTTP response headers for PNaCl caching instead of bitcode hash.
Use Last-Modified and/or ETag values from the server plus the bitcode URL as a cache key. This allows us to remove a hash from the bitcode header and/or the PNaCl manifests. Also, start applying "Cache-Control: no-store" to the translated nexe, if it is part of the pexe's GET response. This also shifts around some of the file_downloader code to allow us to get a callback after the initial GET request, but before the streaming is completely done. Some caveats due to the layering of the trusted NaCl plugin vs the rest of chrome: * We end up with a basic HTTP response parser that splits fields based on what is returned by ppb_url_response_info. This can have been replaced by net/http/http_response_info.h For now, we end up with some extra testing burden. See: nacl_http_response_headers_unittest.cc Once we can depend on net/, we can replace this code. * We end up with some key sanitization. Until we switch from the HTML5 Filesystem to our own cache backend there are 2 or 3 characters that are disallowed in filenames. See: http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#naming-restrictions We did not run into that problem in the past because the NMF file's hash only had hexadecimal characters, which is okay. * Since the URL is now part of the cache, and not some hash of the contents, once the PNaCl cache is not per-origin, we have to be a bit careful that a user can only store something to its own origin. Perhaps that checking can be done with SiteInstance's IsSameWebsite()? This replaces: https://codereview.chromium.org/14683004. With no sha hash to read, there is sha hash to verify. BUG=http://code.google.com/p/nativeclient/issues/detail?id=2992 TEST=ppapi_unittests --gtest_filter=NaClHttpResponseHeadersTest* TEST=browser_tests --gtest_filter=*Pnacl* Review URL: https://chromiumcodereview.appspot.com/16569002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206797 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp/completion_callback.h')
-rw-r--r--ppapi/cpp/completion_callback.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/ppapi/cpp/completion_callback.h b/ppapi/cpp/completion_callback.h
index cdd8b06..14d6784 100644
--- a/ppapi/cpp/completion_callback.h
+++ b/ppapi/cpp/completion_callback.h
@@ -85,6 +85,19 @@ class CompletionCallback {
PP_RunCompletionCallback(&cc_, result);
}
+ /// RunAndClear() is used to run the <code>CompletionCallback</code> and
+ /// clear out the callback so that it cannot be run a second time.
+ ///
+ /// @param[in] result The result of the operation to be passed to the
+ /// callback function. Non-positive values correspond to the error codes
+ /// from <code>pp_errors.h</code> (excluding
+ /// <code>PP_OK_COMPLETIONPENDING</code>). Positive values indicate
+ /// additional information such as bytes read.
+ void RunAndClear(int32_t result) {
+ PP_DCHECK(cc_.func);
+ PP_RunAndClearCompletionCallback(&cc_, result);
+ }
+
/// IsOptional() is used to determine the setting of the
/// <code>PP_COMPLETIONCALLBACK_FLAG_OPTIONAL</code> flag. This flag allows
/// any method taking such callback to complete synchronously