| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "ppapi/proxy/ppb_image_data_proxy.h" | 5 #include "ppapi/proxy/ppb_image_data_proxy.h" |
| 6 | 6 |
| 7 #include <string.h> // For memcpy | 7 #include <string.h> // For memcpy |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 | 113 |
| 114 const void* PPB_ImageData_Proxy::GetSourceInterface() const { | 114 const void* PPB_ImageData_Proxy::GetSourceInterface() const { |
| 115 return &ppb_imagedata; | 115 return &ppb_imagedata; |
| 116 } | 116 } |
| 117 | 117 |
| 118 InterfaceID PPB_ImageData_Proxy::GetInterfaceId() const { | 118 InterfaceID PPB_ImageData_Proxy::GetInterfaceId() const { |
| 119 return INTERFACE_ID_PPB_IMAGE_DATA; | 119 return INTERFACE_ID_PPB_IMAGE_DATA; |
| 120 } | 120 } |
| 121 | 121 |
| 122 void PPB_ImageData_Proxy::OnMessageReceived(const IPC::Message& msg) { | 122 bool PPB_ImageData_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 123 bool handled = true; |
| 123 IPC_BEGIN_MESSAGE_MAP(PPB_ImageData_Proxy, msg) | 124 IPC_BEGIN_MESSAGE_MAP(PPB_ImageData_Proxy, msg) |
| 124 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_GetNativeImageDataFormat, | 125 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_GetNativeImageDataFormat, |
| 125 OnMsgGetNativeImageDataFormat) | 126 OnMsgGetNativeImageDataFormat) |
| 126 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_IsImageDataFormatSupported, | 127 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_IsImageDataFormatSupported, |
| 127 OnMsgIsImageDataFormatSupported) | 128 OnMsgIsImageDataFormatSupported) |
| 128 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_Create, OnMsgCreate) | 129 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_Create, OnMsgCreate) |
| 130 IPC_MESSAGE_UNHANDLED(handled = false) |
| 129 IPC_END_MESSAGE_MAP() | 131 IPC_END_MESSAGE_MAP() |
| 130 // FIXME(brettw) handle bad messages! | 132 // FIXME(brettw) handle bad messages! |
| 133 return handled; |
| 131 } | 134 } |
| 132 | 135 |
| 133 void PPB_ImageData_Proxy::OnMsgGetNativeImageDataFormat(int32* result) { | 136 void PPB_ImageData_Proxy::OnMsgGetNativeImageDataFormat(int32* result) { |
| 134 *result = ppb_image_data_target()->GetNativeImageDataFormat(); | 137 *result = ppb_image_data_target()->GetNativeImageDataFormat(); |
| 135 } | 138 } |
| 136 | 139 |
| 137 void PPB_ImageData_Proxy::OnMsgIsImageDataFormatSupported(int32 format, | 140 void PPB_ImageData_Proxy::OnMsgIsImageDataFormatSupported(int32 format, |
| 138 PP_Bool* result) { | 141 PP_Bool* result) { |
| 139 *result = ppb_image_data_target()->IsImageDataFormatSupported( | 142 *result = ppb_image_data_target()->IsImageDataFormatSupported( |
| 140 static_cast<PP_ImageDataFormat>(format)); | 143 static_cast<PP_ImageDataFormat>(format)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 166 if (trusted) { | 169 if (trusted) { |
| 167 int32_t handle; | 170 int32_t handle; |
| 168 if (trusted->GetSharedMemory(*result, &handle, &byte_count) == PP_OK) | 171 if (trusted->GetSharedMemory(*result, &handle, &byte_count) == PP_OK) |
| 169 *result_image_handle = ImageData::HandleFromInt(handle); | 172 *result_image_handle = ImageData::HandleFromInt(handle); |
| 170 } | 173 } |
| 171 } | 174 } |
| 172 } | 175 } |
| 173 | 176 |
| 174 } // namespace proxy | 177 } // namespace proxy |
| 175 } // namespace pp | 178 } // namespace pp |
| OLD | NEW |