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) { |
| 186 GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id); |
| 187 if (!gpu_process_host) |
| 188 return; |
| 189 |
| 190 gpu_process_host->Send(message.release()); |
| 191 } |
| 192 |
| 193 void PostTaskOnIOThread(const tracked_objects::Location& from_here, |
| 194 base::Closure task) { |
| 195 BrowserThread::PostTask(BrowserThread::IO, from_here, task); |
| 196 } |
| 197 |
185 bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi, | 198 bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi, |
186 content::PageZoom* zoom, | 199 content::PageZoom* zoom, |
187 POINT* zoom_center) { | 200 POINT* zoom_center) { |
188 static long start = 0; | 201 static long start = 0; |
189 static POINT zoom_first; | 202 static POINT zoom_first; |
190 | 203 |
191 if (gi.dwFlags == GF_BEGIN) { | 204 if (gi.dwFlags == GF_BEGIN) { |
192 start = gi.ullArguments; | 205 start = gi.ullArguments; |
193 zoom_first.x = gi.ptsLocation.x; | 206 zoom_first.x = gi.ptsLocation.x; |
194 zoom_first.y = gi.ptsLocation.y; | 207 zoom_first.y = gi.ptsLocation.y; |
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2028 | 2041 |
2029 void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped( | 2042 void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped( |
2030 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 2043 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
2031 int gpu_host_id) { | 2044 int gpu_host_id) { |
2032 if (params.surface_id) { | 2045 if (params.surface_id) { |
2033 if (!accelerated_surface_.get() && compositor_host_window_) { | 2046 if (!accelerated_surface_.get() && compositor_host_window_) { |
2034 accelerated_surface_ = new AcceleratedSurface(compositor_host_window_); | 2047 accelerated_surface_ = new AcceleratedSurface(compositor_host_window_); |
2035 accelerated_surface_->Initialize(); | 2048 accelerated_surface_->Initialize(); |
2036 } | 2049 } |
2037 | 2050 |
| 2051 scoped_ptr<IPC::Message> message( |
| 2052 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); |
| 2053 base::Closure acknowledge_task = base::Bind( |
| 2054 SendToGpuProcessHost, |
| 2055 gpu_host_id, |
| 2056 base::Passed(&message)); |
| 2057 |
2038 accelerated_surface_->AsyncPresentAndAcknowledge( | 2058 accelerated_surface_->AsyncPresentAndAcknowledge( |
2039 params.size, | 2059 params.size, |
2040 params.surface_id, | 2060 params.surface_id, |
2041 base::Bind(&RenderWidgetHost::AcknowledgeSwapBuffers, | 2061 base::Bind(PostTaskOnIOThread, |
2042 gpu_host_id, | 2062 FROM_HERE, |
2043 params.route_id)); | 2063 acknowledge_task)); |
2044 } else { | 2064 } else { |
2045 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); | 2065 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); |
2046 } | 2066 } |
2047 } | 2067 } |
2048 | 2068 |
2049 void RenderWidgetHostViewWin::AcceleratedSurfacePostSubBuffer( | 2069 void RenderWidgetHostViewWin::AcceleratedSurfacePostSubBuffer( |
2050 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 2070 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
2051 int gpu_host_id) { | 2071 int gpu_host_id) { |
2052 RenderWidgetHost::AcknowledgePostSubBuffer(params.route_id, gpu_host_id); | 2072 RenderWidgetHost::AcknowledgePostSubBuffer(params.route_id, gpu_host_id); |
2053 } | 2073 } |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2471 | 2491 |
2472 size_t offset = selection_range_.GetMin() - selection_text_offset_; | 2492 size_t offset = selection_range_.GetMin() - selection_text_offset_; |
2473 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), | 2493 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), |
2474 selection_text_.c_str() + offset, len * sizeof(WCHAR)); | 2494 selection_text_.c_str() + offset, len * sizeof(WCHAR)); |
2475 | 2495 |
2476 // According to Microsft API document, IMR_RECONVERTSTRING and | 2496 // According to Microsft API document, IMR_RECONVERTSTRING and |
2477 // IMR_DOCUMENTFEED should return reconv, but some applications return | 2497 // IMR_DOCUMENTFEED should return reconv, but some applications return |
2478 // need_size. | 2498 // need_size. |
2479 return reinterpret_cast<LRESULT>(reconv); | 2499 return reinterpret_cast<LRESULT>(reconv); |
2480 } | 2500 } |
OLD | NEW |