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