| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/renderer_host/render_widget_host_view_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 case WM_MBUTTONDOWN: | 175 case WM_MBUTTONDOWN: |
| 176 ::SendMessage(GetParent(window), message, wparam, lparam); | 176 ::SendMessage(GetParent(window), message, wparam, lparam); |
| 177 return 0; | 177 return 0; |
| 178 default: | 178 default: |
| 179 break; | 179 break; |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 return ::DefWindowProc(window, message, wparam, lparam); | 182 return ::DefWindowProc(window, message, wparam, lparam); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void SendToGpuProcessHost(int gpu_host_id, scoped_ptr<IPC::Message> message) { | 185 void SendToGpuProcessHost(int gpu_host_id, IPC::Message* m) { |
| 186 // TODO(ajwong): Switch back to Passed() when it becomes available again. |
| 187 scoped_ptr<IPC::Message> message(m); |
| 188 |
| 186 GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id); | 189 GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id); |
| 187 if (!gpu_process_host) | 190 if (!gpu_process_host) |
| 188 return; | 191 return; |
| 189 | 192 |
| 190 gpu_process_host->Send(message.release()); | 193 gpu_process_host->Send(message.release()); |
| 191 } | 194 } |
| 192 | 195 |
| 193 void PostTaskOnIOThread(const tracked_objects::Location& from_here, | 196 void PostTaskOnIOThread(const tracked_objects::Location& from_here, |
| 194 base::Closure task) { | 197 base::Closure task) { |
| 195 BrowserThread::PostTask(BrowserThread::IO, from_here, task); | 198 BrowserThread::PostTask(BrowserThread::IO, from_here, task); |
| (...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 | 2044 |
| 2042 void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped( | 2045 void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped( |
| 2043 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 2046 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 2044 int gpu_host_id) { | 2047 int gpu_host_id) { |
| 2045 if (params.surface_id) { | 2048 if (params.surface_id) { |
| 2046 if (!accelerated_surface_.get() && compositor_host_window_) { | 2049 if (!accelerated_surface_.get() && compositor_host_window_) { |
| 2047 accelerated_surface_ = new AcceleratedSurface(compositor_host_window_); | 2050 accelerated_surface_ = new AcceleratedSurface(compositor_host_window_); |
| 2048 accelerated_surface_->Initialize(); | 2051 accelerated_surface_->Initialize(); |
| 2049 } | 2052 } |
| 2050 | 2053 |
| 2051 scoped_ptr<IPC::Message> message( | |
| 2052 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); | |
| 2053 base::Closure acknowledge_task = base::Bind( | 2054 base::Closure acknowledge_task = base::Bind( |
| 2054 SendToGpuProcessHost, | 2055 SendToGpuProcessHost, |
| 2055 gpu_host_id, | 2056 gpu_host_id, |
| 2056 base::Passed(&message)); | 2057 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); |
| 2057 | 2058 |
| 2058 accelerated_surface_->AsyncPresentAndAcknowledge( | 2059 accelerated_surface_->AsyncPresentAndAcknowledge( |
| 2059 params.size, | 2060 params.size, |
| 2060 params.surface_id, | 2061 params.surface_id, |
| 2061 base::Bind(PostTaskOnIOThread, | 2062 base::Bind(PostTaskOnIOThread, |
| 2062 FROM_HERE, | 2063 FROM_HERE, |
| 2063 acknowledge_task)); | 2064 acknowledge_task)); |
| 2064 } else { | 2065 } else { |
| 2065 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); | 2066 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); |
| 2066 } | 2067 } |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2491 | 2492 |
| 2492 size_t offset = selection_range_.GetMin() - selection_text_offset_; | 2493 size_t offset = selection_range_.GetMin() - selection_text_offset_; |
| 2493 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), | 2494 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), |
| 2494 selection_text_.c_str() + offset, len * sizeof(WCHAR)); | 2495 selection_text_.c_str() + offset, len * sizeof(WCHAR)); |
| 2495 | 2496 |
| 2496 // According to Microsft API document, IMR_RECONVERTSTRING and | 2497 // According to Microsft API document, IMR_RECONVERTSTRING and |
| 2497 // IMR_DOCUMENTFEED should return reconv, but some applications return | 2498 // IMR_DOCUMENTFEED should return reconv, but some applications return |
| 2498 // need_size. | 2499 // need_size. |
| 2499 return reinterpret_cast<LRESULT>(reconv); | 2500 return reinterpret_cast<LRESULT>(reconv); |
| 2500 } | 2501 } |
| OLD | NEW |