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

Unified Diff: webkit/plugins/ppapi/ppb_url_loader_impl.h

Issue 6220006: Fix Pepper URL Loader callbacks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: eliminated TODO per review Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/tests/test_url_loader.cc ('k') | webkit/plugins/ppapi/ppb_url_loader_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_url_loader_impl.h
diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.h b/webkit/plugins/ppapi/ppb_url_loader_impl.h
index 6b05adc99bfedbdb510289216f5e605c409b64dd..4a3d72ecf3cf9587054bf424f87c6898dff37e3c 100644
--- a/webkit/plugins/ppapi/ppb_url_loader_impl.h
+++ b/webkit/plugins/ppapi/ppb_url_loader_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,10 +7,12 @@
#include <deque>
+#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h"
+#include "webkit/plugins/ppapi/callbacks.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/resource.h"
@@ -89,7 +91,17 @@ class PPB_URLLoader_Impl : public Resource,
PPB_URLResponseInfo_Impl* response_info() const { return response_info_; }
private:
+ // Check that |callback| is valid (only non-blocking operation is supported)
+ // and that no callback is already pending. Returns |PP_OK| if okay, else
+ // |PP_ERROR_...| to be returned to the plugin.
+ int32_t ValidateCallback(PP_CompletionCallback callback);
+
+ // Sets up |callback| as the pending callback. This should only be called once
+ // it is certain that |PP_ERROR_WOULDBLOCK| will be returned.
+ void RegisterCallback(PP_CompletionCallback callback);
+
void RunCallback(int32_t result);
+
size_t FillUserBuffer();
// Converts a WebURLResponse to a URLResponseInfo and saves it.
@@ -110,10 +122,11 @@ class PPB_URLLoader_Impl : public Resource,
bool RecordDownloadProgress() const;
bool RecordUploadProgress() const;
- // This will be NULL if the instance has been deleted but this PPB_URLLoader_Impl was
- // somehow leaked. In general, you should not need to check this for NULL.
- // However, if you see a NULL pointer crash, that means somebody is holding
- // a reference to this object longer than the PluginInstance's lifetime.
+ // This will be NULL if the instance has been deleted but this
+ // PPB_URLLoader_Impl was somehow leaked. In general, you should not need to
+ // check this for NULL. However, if you see a NULL pointer crash, that means
+ // somebody is holding a reference to this object longer than the
+ // PluginInstance's lifetime.
PluginInstance* instance_;
// If true, then the plugin instance is a full-frame plugin and we're just
@@ -122,7 +135,7 @@ class PPB_URLLoader_Impl : public Resource,
scoped_ptr<WebKit::WebURLLoader> loader_;
scoped_refptr<PPB_URLRequestInfo_Impl> request_info_;
scoped_refptr<PPB_URLResponseInfo_Impl> response_info_;
- PP_CompletionCallback pending_callback_;
+ scoped_refptr<TrackedCompletionCallback> pending_callback_;
std::deque<char> buffer_;
int64_t bytes_sent_;
int64_t total_bytes_to_be_sent_;
« no previous file with comments | « ppapi/tests/test_url_loader.cc ('k') | webkit/plugins/ppapi/ppb_url_loader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698