Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2012 The Native Client 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 <limits> | 5 #include <limits> |
| 6 #include <new> | 6 #include <new> |
| 7 #include "native_client/src/include/portability.h" | 7 #include "native_client/src/include/portability.h" |
| 8 #include "native_client/src/include/portability_string.h" | 8 #include "native_client/src/include/portability_string.h" |
| 9 #include "native_client/src/public/imc_types.h" | 9 #include "native_client/src/public/imc_types.h" |
| 10 #include "native_client/src/shared/imc/nacl_imc_c.h" | 10 #include "native_client/src/shared/imc/nacl_imc_c.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 } | 308 } |
| 309 | 309 |
| 310 DescWrapper* DescWrapperFactory::MakeFileDesc(int host_os_desc, int mode) { | 310 DescWrapper* DescWrapperFactory::MakeFileDesc(int host_os_desc, int mode) { |
| 311 struct NaClDesc* desc = ImportHostDescCommon(host_os_desc, mode); | 311 struct NaClDesc* desc = ImportHostDescCommon(host_os_desc, mode); |
| 312 if (NULL == desc) { | 312 if (NULL == desc) { |
| 313 return NULL; | 313 return NULL; |
| 314 } | 314 } |
| 315 return MakeGenericCleanup(desc); | 315 return MakeGenericCleanup(desc); |
| 316 } | 316 } |
| 317 | 317 |
| 318 DescWrapper* DescWrapperFactory::MakeFileDescMetadata(struct NaClFileInfo info, | |
| 319 int mode) { | |
| 320 int error; | |
| 321 struct NaClDesc* desc = ImportHostDescCommon(info.desc, mode); | |
| 322 if (NULL == desc) { | |
| 323 return NULL; | |
| 324 } | |
| 325 if (info.file_token.lo != 0 || info.file_token.hi != 0) { | |
|
Nick Bray (chromium)
2014/05/02 19:44:35
See previous CLs for comments on this check.
jvoung (off chromium)
2014/05/02 20:38:23
Done.
| |
| 326 error = (*NACL_VTBL(NaClDesc, desc)-> | |
|
Nick Bray (chromium)
2014/05/02 19:44:35
Why no NaClDescSetFileToken?
jvoung (off chromium)
2014/05/02 20:38:23
That's part of desc_cacheabiilty/ and desc_cacheab
| |
| 327 SetMetadata)(desc, | |
| 328 NACL_DESC_METADATA_FILE_TOKEN_TYPE, | |
| 329 sizeof info.file_token, | |
| 330 (uint8_t const *) &info.file_token); | |
| 331 if (0 != error) { | |
| 332 NaClDescSafeUnref(desc); | |
| 333 return NULL; | |
| 334 } | |
| 335 } | |
| 336 return MakeGenericCleanup(desc); | |
| 337 } | |
| 338 | |
| 318 DescWrapper* DescWrapperFactory::MakeFileDescQuota(int host_os_desc, | 339 DescWrapper* DescWrapperFactory::MakeFileDescQuota(int host_os_desc, |
| 319 int mode, | 340 int mode, |
| 320 const uint8_t* file_id) { | 341 const uint8_t* file_id) { |
| 321 struct NaClDesc* desc = ImportHostDescCommon(host_os_desc, mode); | 342 struct NaClDesc* desc = ImportHostDescCommon(host_os_desc, mode); |
| 322 if (NULL == desc) { | 343 if (NULL == desc) { |
| 323 return NULL; | 344 return NULL; |
| 324 } | 345 } |
| 325 struct NaClDesc* desc_quota = MakeQuotaCommon(file_id, desc); | 346 struct NaClDesc* desc_quota = MakeQuotaCommon(file_id, desc); |
| 326 if (desc_quota == NULL) { | 347 if (desc_quota == NULL) { |
| 327 NaClDescSafeUnref(desc); | 348 NaClDescSafeUnref(desc); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 630 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> | 651 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> |
| 631 SemWait(desc_); | 652 SemWait(desc_); |
| 632 } | 653 } |
| 633 | 654 |
| 634 int DescWrapper::GetValue() { | 655 int DescWrapper::GetValue() { |
| 635 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> | 656 return reinterpret_cast<struct NaClDescVtbl const *>(desc_->base.vtbl)-> |
| 636 GetValue(desc_); | 657 GetValue(desc_); |
| 637 } | 658 } |
| 638 | 659 |
| 639 } // namespace nacl | 660 } // namespace nacl |
| OLD | NEW |