Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/common/sandbox_linux/bpf_gpu_policy_linux.h" | 5 #include "content/common/sandbox_linux/bpf_gpu_policy_linux.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 } | 71 } |
| 72 | 72 |
| 73 inline bool IsArchitectureArm() { | 73 inline bool IsArchitectureArm() { |
| 74 #if defined(__arm__) || defined(__aarch64__) | 74 #if defined(__arm__) || defined(__aarch64__) |
| 75 return true; | 75 return true; |
| 76 #else | 76 #else |
| 77 return false; | 77 return false; |
| 78 #endif | 78 #endif |
| 79 } | 79 } |
| 80 | 80 |
| 81 inline bool IsOzone() { | 81 inline bool UseV4L2Codec() { |
| 82 #if defined(USE_OZONE) | 82 #if defined(USE_V4L2_CODEC) |
| 83 return true; | 83 return true; |
| 84 #else | 84 #else |
| 85 return false; | 85 return false; |
| 86 #endif | 86 #endif |
| 87 } | 87 } |
| 88 | 88 |
| 89 inline bool UseLibV4L2() { | 89 inline bool UseLibV4L2() { |
| 90 #if defined(USE_LIBV4L2) | 90 #if defined(USE_LIBV4L2) |
| 91 return true; | 91 return true; |
| 92 #else | 92 #else |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 | 336 |
| 337 CHECK(broker_process_ == NULL); | 337 CHECK(broker_process_ == NULL); |
| 338 | 338 |
| 339 // All GPU process policies need these files brokered out. | 339 // All GPU process policies need these files brokered out. |
| 340 std::vector<BrokerFilePermission> permissions; | 340 std::vector<BrokerFilePermission> permissions; |
| 341 permissions.push_back(BrokerFilePermission::ReadWrite(kDriCard0Path)); | 341 permissions.push_back(BrokerFilePermission::ReadWrite(kDriCard0Path)); |
| 342 permissions.push_back(BrokerFilePermission::ReadOnly(kDriRcPath)); | 342 permissions.push_back(BrokerFilePermission::ReadOnly(kDriRcPath)); |
| 343 if (!IsChromeOS()) { | 343 if (!IsChromeOS()) { |
| 344 permissions.push_back( | 344 permissions.push_back( |
| 345 BrokerFilePermission::ReadWriteCreateUnlinkRecursive(kDevShm)); | 345 BrokerFilePermission::ReadWriteCreateUnlinkRecursive(kDevShm)); |
| 346 } else if (IsArchitectureArm() || IsOzone()){ | 346 } else if (UseV4L2Codec()){ |
|
Jorge Lucangeli Obes
2016/07/13 13:09:17
Why did you remove IsArchitectureArm?
wuchengli
2016/07/13 13:26:04
We now use USE_V4L2_CODEC to decide if a device ca
| |
| 347 AddV4L2GpuWhitelist(&permissions); | 347 AddV4L2GpuWhitelist(&permissions); |
| 348 if (UseLibV4L2()) { | 348 if (UseLibV4L2()) { |
| 349 dlopen("/usr/lib/libv4l2.so", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); | 349 dlopen("/usr/lib/libv4l2.so", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); |
| 350 // This is a device-specific encoder plugin. | 350 // This is a device-specific encoder plugin. |
| 351 dlopen("/usr/lib/libv4l/plugins/libv4l-encplugin.so", | 351 dlopen("/usr/lib/libv4l/plugins/libv4l-encplugin.so", |
| 352 RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); | 352 RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); |
| 353 } | 353 } |
| 354 } | 354 } |
| 355 | 355 |
| 356 // Add eventual extra files from permissions_extra. | 356 // Add eventual extra files from permissions_extra. |
| 357 for (const auto& perm : permissions_extra) { | 357 for (const auto& perm : permissions_extra) { |
| 358 permissions.push_back(perm); | 358 permissions.push_back(perm); |
| 359 } | 359 } |
| 360 | 360 |
| 361 broker_process_ = new BrokerProcess(GetFSDeniedErrno(), permissions); | 361 broker_process_ = new BrokerProcess(GetFSDeniedErrno(), permissions); |
| 362 // The initialization callback will perform generic initialization and then | 362 // The initialization callback will perform generic initialization and then |
| 363 // call broker_sandboxer_callback. | 363 // call broker_sandboxer_callback. |
| 364 CHECK(broker_process_->Init(base::Bind(&UpdateProcessTypeAndEnableSandbox, | 364 CHECK(broker_process_->Init(base::Bind(&UpdateProcessTypeAndEnableSandbox, |
| 365 broker_sandboxer_allocator))); | 365 broker_sandboxer_allocator))); |
| 366 } | 366 } |
| 367 | 367 |
| 368 } // namespace content | 368 } // namespace content |
| OLD | NEW |