OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/renderer/pepper/ppb_nacl_private_impl.h" | 5 #include "chrome/renderer/pepper/ppb_nacl_private_impl.h" |
6 | 6 |
7 #ifndef DISABLE_NACL | 7 #ifndef DISABLE_NACL |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 transit_fd); | 251 transit_fd); |
252 return handle; | 252 return handle; |
253 } | 253 } |
254 | 254 |
255 int32_t GetNexeFd(PP_Instance instance, | 255 int32_t GetNexeFd(PP_Instance instance, |
256 const char* pexe_url, | 256 const char* pexe_url, |
257 uint32_t abi_version, | 257 uint32_t abi_version, |
258 uint32_t opt_level, | 258 uint32_t opt_level, |
259 const char* last_modified, | 259 const char* last_modified, |
260 const char* etag, | 260 const char* etag, |
261 PP_Bool has_no_store_header, | |
262 PP_Bool* is_hit, | 261 PP_Bool* is_hit, |
263 PP_FileHandle* handle, | 262 PP_FileHandle* handle, |
264 struct PP_CompletionCallback callback) { | 263 struct PP_CompletionCallback callback) { |
265 ppapi::thunk::EnterInstance enter(instance, callback); | 264 ppapi::thunk::EnterInstance enter(instance, callback); |
266 if (enter.failed()) | 265 if (enter.failed()) |
267 return enter.retval(); | 266 return enter.retval(); |
268 if (!pexe_url || !last_modified || !etag || !is_hit || !handle) | 267 if (!pexe_url || !last_modified || !etag || !is_hit || !handle) |
269 return enter.SetResult(PP_ERROR_BADARGUMENT); | 268 return enter.SetResult(PP_ERROR_BADARGUMENT); |
270 if (!InitializePnaclResourceHost()) | 269 if (!InitializePnaclResourceHost()) |
271 return enter.SetResult(PP_ERROR_FAILED); | 270 return enter.SetResult(PP_ERROR_FAILED); |
272 | 271 |
273 base::Time last_modified_time; | 272 base::Time last_modified_time; |
274 // If FromString fails, it doesn't touch last_modified_time and we just send | 273 // If FromString fails, it doesn't touch last_modified_time and we just send |
275 // the default-constructed null value. | 274 // the default-constructed null value. |
276 base::Time::FromString(last_modified, &last_modified_time); | 275 base::Time::FromString(last_modified, &last_modified_time); |
277 | 276 |
278 nacl::PnaclCacheInfo cache_info; | 277 nacl::PnaclCacheInfo cache_info; |
279 cache_info.pexe_url = GURL(pexe_url); | 278 cache_info.pexe_url = GURL(pexe_url); |
280 cache_info.abi_version = abi_version; | 279 cache_info.abi_version = abi_version; |
281 cache_info.opt_level = opt_level; | 280 cache_info.opt_level = opt_level; |
282 cache_info.last_modified = last_modified_time; | 281 cache_info.last_modified = last_modified_time; |
283 cache_info.etag = std::string(etag); | 282 cache_info.etag = std::string(etag); |
284 cache_info.has_no_store_header = PP_ToBool(has_no_store_header); | |
285 | 283 |
286 g_pnacl_resource_host.Get()->RequestNexeFd( | 284 g_pnacl_resource_host.Get()->RequestNexeFd( |
287 GetRoutingID(instance), | 285 GetRoutingID(instance), |
288 instance, | 286 instance, |
289 cache_info, | 287 cache_info, |
290 is_hit, | 288 is_hit, |
291 handle, | 289 handle, |
292 enter.callback()); | 290 enter.callback()); |
293 | 291 |
294 return enter.SetResult(PP_OK_COMPLETIONPENDING); | 292 return enter.SetResult(PP_OK_COMPLETIONPENDING); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 &OpenNaClExecutable | 369 &OpenNaClExecutable |
372 }; | 370 }; |
373 | 371 |
374 } // namespace | 372 } // namespace |
375 | 373 |
376 const PPB_NaCl_Private* PPB_NaCl_Private_Impl::GetInterface() { | 374 const PPB_NaCl_Private* PPB_NaCl_Private_Impl::GetInterface() { |
377 return &nacl_interface; | 375 return &nacl_interface; |
378 } | 376 } |
379 | 377 |
380 #endif // DISABLE_NACL | 378 #endif // DISABLE_NACL |
OLD | NEW |