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

Side by Side Diff: chrome/renderer/pepper/pnacl_translation_resource_host.cc

Issue 22309007: Add success status to ReportTranslationFinished in ppb_nacl_private and IPC (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jvoung, dmichael reviews Created 7 years, 4 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "pnacl_translation_resource_host.h" 5 #include "pnacl_translation_resource_host.h"
6 6
7 #ifndef DISABLE_NACL 7 #ifndef DISABLE_NACL
8 #include "components/nacl/common/nacl_host_messages.h" 8 #include "components/nacl/common/nacl_host_messages.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/shared_impl/ppapi_globals.h" 10 #include "ppapi/shared_impl/ppapi_globals.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 base::Bind(&TrackedCallback::Run, 95 base::Bind(&TrackedCallback::Run,
96 callback, 96 callback,
97 static_cast<int32_t>(PP_ERROR_FAILED))); 97 static_cast<int32_t>(PP_ERROR_FAILED)));
98 return; 98 return;
99 } 99 }
100 pending_cache_requests_.insert(std::make_pair( 100 pending_cache_requests_.insert(std::make_pair(
101 instance, CacheRequestInfo(is_hit, file_handle, callback))); 101 instance, CacheRequestInfo(is_hit, file_handle, callback)));
102 } 102 }
103 103
104 void PnaclTranslationResourceHost::ReportTranslationFinished( 104 void PnaclTranslationResourceHost::ReportTranslationFinished(
105 PP_Instance instance) { 105 PP_Instance instance,
106 PP_Bool success) {
106 DCHECK(PpapiGlobals::Get()-> 107 DCHECK(PpapiGlobals::Get()->
107 GetMainThreadMessageLoop()->BelongsToCurrentThread()); 108 GetMainThreadMessageLoop()->BelongsToCurrentThread());
108 io_message_loop_->PostTask( 109 io_message_loop_->PostTask(
109 FROM_HERE, 110 FROM_HERE,
110 base::Bind(&PnaclTranslationResourceHost::SendReportTranslationFinished, 111 base::Bind(&PnaclTranslationResourceHost::SendReportTranslationFinished,
111 this, 112 this,
112 instance)); 113 instance,
114 success));
113 return; 115 return;
114 } 116 }
115 117
116 void PnaclTranslationResourceHost::SendReportTranslationFinished( 118 void PnaclTranslationResourceHost::SendReportTranslationFinished(
117 PP_Instance instance) { 119 PP_Instance instance,
120 PP_Bool success) {
118 DCHECK(io_message_loop_->BelongsToCurrentThread()); 121 DCHECK(io_message_loop_->BelongsToCurrentThread());
119 // If the channel is closed or we have been detached, we are probably shutting 122 // If the channel is closed or we have been detached, we are probably shutting
120 // down, so just don't send anything. 123 // down, so just don't send anything.
121 if (!channel_) 124 if (!channel_)
122 return; 125 return;
123 DCHECK(pending_cache_requests_.count(instance) == 0); 126 DCHECK(pending_cache_requests_.count(instance) == 0);
124 channel_->Send(new NaClHostMsg_ReportTranslationFinished(instance)); 127 channel_->Send(new NaClHostMsg_ReportTranslationFinished(instance,
128 PP_ToBool(success)));
125 } 129 }
126 130
127 void PnaclTranslationResourceHost::OnNexeTempFileReply( 131 void PnaclTranslationResourceHost::OnNexeTempFileReply(
128 PP_Instance instance, 132 PP_Instance instance,
129 bool is_hit, 133 bool is_hit,
130 IPC::PlatformFileForTransit file) { 134 IPC::PlatformFileForTransit file) {
131 DCHECK(io_message_loop_->BelongsToCurrentThread()); 135 DCHECK(io_message_loop_->BelongsToCurrentThread());
132 CacheRequestInfoMap::iterator it = pending_cache_requests_.find(instance); 136 CacheRequestInfoMap::iterator it = pending_cache_requests_.find(instance);
133 int32_t status = PP_ERROR_FAILED; 137 int32_t status = PP_ERROR_FAILED;
134 // Handle the expected successful case first. 138 // Handle the expected successful case first.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 for (EnsurePnaclInstalledList::iterator 228 for (EnsurePnaclInstalledList::iterator
225 i = pending_ensure_pnacl_requests_.begin(), 229 i = pending_ensure_pnacl_requests_.begin(),
226 e = pending_ensure_pnacl_requests_.end(); 230 e = pending_ensure_pnacl_requests_.end();
227 i != e; ++i) { 231 i != e; ++i) {
228 (*i)->PostAbort(); 232 (*i)->PostAbort();
229 } 233 }
230 pending_ensure_pnacl_requests_.clear(); 234 pending_ensure_pnacl_requests_.clear();
231 } 235 }
232 236
233 #endif // DISABLE_NACL 237 #endif // DISABLE_NACL
OLDNEW
« no previous file with comments | « chrome/renderer/pepper/pnacl_translation_resource_host.h ('k') | chrome/renderer/pepper/ppb_nacl_private_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698