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

Unified Diff: components/nacl/renderer/ppb_nacl_private_impl.cc

Issue 275403004: Revert of Pepper: Clean up ProgressEvent logic. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/nacl/renderer/nexe_load_manager.cc ('k') | components/nacl/renderer/progress_event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/renderer/ppb_nacl_private_impl.cc
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index c4a8784737b7aae53e8b4fce10ac291b6c773ad5..3361f61783c86f485bdf6ae9bcb5224e1ec5a44a 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -26,7 +26,6 @@
#include "components/nacl/renderer/manifest_service_channel.h"
#include "components/nacl/renderer/nexe_load_manager.h"
#include "components/nacl/renderer/pnacl_translation_resource_host.h"
-#include "components/nacl/renderer/progress_event.h"
#include "components/nacl/renderer/sandbox_arch.h"
#include "components/nacl/renderer/trusted_plugin_channel.h"
#include "content/public/common/content_client.h"
@@ -648,18 +647,48 @@
return handle;
}
+void DispatchEventOnMainThread(PP_Instance instance,
+ PP_NaClEventType event_type,
+ const std::string& resource_url,
+ PP_Bool length_is_computable,
+ uint64_t loaded_bytes,
+ uint64_t total_bytes);
+
void DispatchEvent(PP_Instance instance,
PP_NaClEventType event_type,
const char *resource_url,
PP_Bool length_is_computable,
uint64_t loaded_bytes,
uint64_t total_bytes) {
- ProgressEvent event(event_type,
- resource_url,
- PP_ToBool(length_is_computable),
- loaded_bytes,
- total_bytes);
- DispatchProgressEvent(instance, event);
+ ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
+ FROM_HERE,
+ base::Bind(&DispatchEventOnMainThread,
+ instance,
+ event_type,
+ std::string(resource_url),
+ length_is_computable,
+ loaded_bytes,
+ total_bytes));
+}
+
+void DispatchEventOnMainThread(PP_Instance instance,
+ PP_NaClEventType event_type,
+ const std::string& resource_url,
+ PP_Bool length_is_computable,
+ uint64_t loaded_bytes,
+ uint64_t total_bytes) {
+ NexeLoadManager* load_manager =
+ GetNexeLoadManager(instance);
+ // The instance may have been destroyed after we were scheduled, so do
+ // nothing if it's gone.
+ if (load_manager) {
+ NexeLoadManager::ProgressEvent event(event_type);
+ event.resource_url = resource_url;
+ event.length_is_computable = PP_ToBool(length_is_computable);
+ event.loaded_bytes = loaded_bytes;
+ event.total_bytes = total_bytes;
+ load_manager->DispatchEvent(event);
+ }
}
void NexeFileDidOpen(PP_Instance instance,
« no previous file with comments | « components/nacl/renderer/nexe_load_manager.cc ('k') | components/nacl/renderer/progress_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698