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

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

Issue 270453004: Pepper: Clean up ProgressEvent logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: probable crash fix 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 e9efc6b5ba027b6b132b23d65b92f1f91ab04409..2623e28b89cf73d3447687dbf6a79dde173ef397 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -26,6 +26,7 @@
#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"
@@ -654,48 +655,18 @@ PP_FileHandle OpenNaClExecutable(PP_Instance instance,
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) {
- 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);
- }
+ ProgressEvent event(event_type,
+ resource_url,
+ PP_ToBool(length_is_computable),
+ loaded_bytes,
+ total_bytes);
+ DispatchProgressEvent(instance, 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