| 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/nacl/nacl_listener.h" | 5 #include "chrome/nacl/nacl_listener.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 } // namespace | 105 } // namespace |
| 106 | 106 |
| 107 class BrowserValidationDBProxy : public NaClValidationDB { | 107 class BrowserValidationDBProxy : public NaClValidationDB { |
| 108 public: | 108 public: |
| 109 explicit BrowserValidationDBProxy(NaClListener* listener) | 109 explicit BrowserValidationDBProxy(NaClListener* listener) |
| 110 : listener_(listener) { | 110 : listener_(listener) { |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool QueryKnownToValidate(const std::string& signature) { | 113 virtual bool QueryKnownToValidate(const std::string& signature) OVERRIDE { |
| 114 // Initialize to false so that if the Send fails to write to the return | 114 // Initialize to false so that if the Send fails to write to the return |
| 115 // value we're safe. For example if the message is (for some reason) | 115 // value we're safe. For example if the message is (for some reason) |
| 116 // dispatched as an async message the return parameter will not be written. | 116 // dispatched as an async message the return parameter will not be written. |
| 117 bool result = false; | 117 bool result = false; |
| 118 if (!listener_->Send(new NaClProcessMsg_QueryKnownToValidate(signature, | 118 if (!listener_->Send(new NaClProcessMsg_QueryKnownToValidate(signature, |
| 119 &result))) { | 119 &result))) { |
| 120 LOG(ERROR) << "Failed to query NaCl validation cache."; | 120 LOG(ERROR) << "Failed to query NaCl validation cache."; |
| 121 result = false; | 121 result = false; |
| 122 } | 122 } |
| 123 return result; | 123 return result; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void SetKnownToValidate(const std::string& signature) { | 126 virtual void SetKnownToValidate(const std::string& signature) OVERRIDE { |
| 127 // Caching is optional: NaCl will still work correctly if the IPC fails. | 127 // Caching is optional: NaCl will still work correctly if the IPC fails. |
| 128 if (!listener_->Send(new NaClProcessMsg_SetKnownToValidate(signature))) { | 128 if (!listener_->Send(new NaClProcessMsg_SetKnownToValidate(signature))) { |
| 129 LOG(ERROR) << "Failed to update NaCl validation cache."; | 129 LOG(ERROR) << "Failed to update NaCl validation cache."; |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 private: | 133 private: |
| 134 // The listener never dies, otherwise this might be a dangling reference. | 134 // The listener never dies, otherwise this might be a dangling reference. |
| 135 NaClListener* listener_; | 135 NaClListener* listener_; |
| 136 }; | 136 }; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 #if defined(OS_WIN) | 274 #if defined(OS_WIN) |
| 275 args->broker_duplicate_handle_func = BrokerDuplicateHandle; | 275 args->broker_duplicate_handle_func = BrokerDuplicateHandle; |
| 276 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; | 276 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; |
| 277 #endif | 277 #endif |
| 278 #if defined(OS_LINUX) | 278 #if defined(OS_LINUX) |
| 279 args->prereserved_sandbox_size = prereserved_sandbox_size_; | 279 args->prereserved_sandbox_size = prereserved_sandbox_size_; |
| 280 #endif | 280 #endif |
| 281 NaClChromeMainStart(args); | 281 NaClChromeMainStart(args); |
| 282 NOTREACHED(); | 282 NOTREACHED(); |
| 283 } | 283 } |
| OLD | NEW |