| OLD | NEW |
| 1 // Copyright (c) 2010 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "native_client/src/shared/ppapi_proxy/browser_upcall.h" | 5 #include "native_client/src/shared/ppapi_proxy/browser_upcall.h" |
| 6 | 6 |
| 7 #include <new> | 7 #include <new> |
| 8 | 8 |
| 9 #include "srpcgen/upcall.h" | 9 #include "srpcgen/upcall.h" |
| 10 #include "native_client/src/include/portability.h" | 10 #include "native_client/src/include/portability.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // Plugin-side calls to CallOnMainThread are sent as RPCs to the | 44 // Plugin-side calls to CallOnMainThread are sent as RPCs to the |
| 45 // browser. The browser responds to the RPC by putting the following thunk on | 45 // browser. The browser responds to the RPC by putting the following thunk on |
| 46 // the the browser's message queue. The browser will call it back on the | 46 // the the browser's message queue. The browser will call it back on the |
| 47 // browser's NPAPI thread, so it is safe to invoke an NPNavigatorRpc interface | 47 // browser's NPAPI thread, so it is safe to invoke an NPNavigatorRpc interface |
| 48 // from here. | 48 // from here. |
| 49 static void CallOnMainThreadThunk(void* arg, int32_t res) { | 49 static void CallOnMainThreadThunk(void* arg, int32_t res) { |
| 50 nacl::scoped_ptr<UserData> closure(reinterpret_cast<UserData*>(arg)); | 50 nacl::scoped_ptr<UserData> closure(reinterpret_cast<UserData*>(arg)); |
| 51 UNREFERENCED_PARAMETER(res); | 51 UNREFERENCED_PARAMETER(res); |
| 52 if (closure != NULL) { | 52 if (closure != NULL) { |
| 53 // TODO(sehr): Send an RPC back to the NaCl module to run it's closure. | 53 // TODO(sehr): Send an RPC back to the NaCl module to run it's closure. |
| 54 ppapi_proxy::DebugPrintf("Closure run was invoked!\n"); | 54 ppapi_proxy::DebugPrintf("Browser::CallOnMainThread: " |
| 55 "closure run was invoked!\n"); |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 | 58 |
| 58 // Structure for passing information to the thread. Shares ownership of | 59 // Structure for passing information to the thread. Shares ownership of |
| 59 // the descriptor with the creating routine. This allows passing ownership | 60 // the descriptor with the creating routine. This allows passing ownership |
| 60 // to the upcall thread. | 61 // to the upcall thread. |
| 61 class UpcallInfo { | 62 class UpcallInfo { |
| 62 public: | 63 public: |
| 63 UpcallInfo(DescWrapper* wrapper, NaClSrpcChannel* channel) { | 64 UpcallInfo(DescWrapper* wrapper, NaClSrpcChannel* channel) { |
| 64 wrapper_ = wrapper; | 65 wrapper_ = wrapper; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 int64_t device_context, | 151 int64_t device_context, |
| 151 int32_t callback_index, | 152 int32_t callback_index, |
| 152 int32_t* result) { | 153 int32_t* result) { |
| 153 NaClSrpcClosureRunner runner(done); | 154 NaClSrpcClosureRunner runner(done); |
| 154 rpc->result = NACL_SRPC_RESULT_APP_ERROR; | 155 rpc->result = NACL_SRPC_RESULT_APP_ERROR; |
| 155 UNREFERENCED_PARAMETER(device_context); | 156 UNREFERENCED_PARAMETER(device_context); |
| 156 UNREFERENCED_PARAMETER(callback_index); | 157 UNREFERENCED_PARAMETER(callback_index); |
| 157 UNREFERENCED_PARAMETER(result); | 158 UNREFERENCED_PARAMETER(result); |
| 158 NACL_UNIMPLEMENTED(); | 159 NACL_UNIMPLEMENTED(); |
| 159 } | 160 } |
| OLD | NEW |