OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_view_host.h" | 5 #include "content/browser/renderer_host/render_view_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
13 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "content/browser/child_process_security_policy.h" | 20 #include "content/browser/child_process_security_policy.h" |
21 #include "content/browser/cross_site_request_manager.h" | 21 #include "content/browser/cross_site_request_manager.h" |
| 22 #include "content/browser/gpu/gpu_surface_tracker.h" |
22 #include "content/browser/host_zoom_map.h" | 23 #include "content/browser/host_zoom_map.h" |
23 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 24 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
24 #include "content/browser/power_save_blocker.h" | 25 #include "content/browser/power_save_blocker.h" |
25 #include "content/browser/renderer_host/render_process_host_impl.h" | 26 #include "content/browser/renderer_host/render_process_host_impl.h" |
26 #include "content/browser/renderer_host/render_view_host_delegate.h" | 27 #include "content/browser/renderer_host/render_view_host_delegate.h" |
27 #include "content/browser/renderer_host/render_widget_host.h" | 28 #include "content/browser/renderer_host/render_widget_host.h" |
28 #include "content/browser/renderer_host/render_widget_host_view.h" | 29 #include "content/browser/renderer_host/render_widget_host_view.h" |
29 #include "content/browser/site_instance.h" | 30 #include "content/browser/site_instance.h" |
30 #include "content/common/desktop_notification_messages.h" | 31 #include "content/common/desktop_notification_messages.h" |
31 #include "content/common/drag_messages.h" | 32 #include "content/common/drag_messages.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // initialized it) or may not (we have our own process or the old process | 170 // initialized it) or may not (we have our own process or the old process |
170 // crashed) have been initialized. Calling Init multiple times will be | 171 // crashed) have been initialized. Calling Init multiple times will be |
171 // ignored, so this is safe. | 172 // ignored, so this is safe. |
172 if (!process()->Init(renderer_accessible())) | 173 if (!process()->Init(renderer_accessible())) |
173 return false; | 174 return false; |
174 DCHECK(process()->HasConnection()); | 175 DCHECK(process()->HasConnection()); |
175 DCHECK(process()->GetBrowserContext()); | 176 DCHECK(process()->GetBrowserContext()); |
176 | 177 |
177 renderer_initialized_ = true; | 178 renderer_initialized_ = true; |
178 | 179 |
179 process()->SetCompositingSurface(routing_id(), | 180 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
180 GetCompositingSurface()); | 181 surface_id(), GetCompositingSurface()); |
181 | 182 |
182 // Ensure the RenderView starts with a next_page_id larger than any existing | 183 // Ensure the RenderView starts with a next_page_id larger than any existing |
183 // page ID it might be asked to render. | 184 // page ID it might be asked to render. |
184 int32 next_page_id = 1; | 185 int32 next_page_id = 1; |
185 if (max_page_id > -1) | 186 if (max_page_id > -1) |
186 next_page_id = max_page_id + 1; | 187 next_page_id = max_page_id + 1; |
187 | 188 |
188 ViewMsg_New_Params params; | 189 ViewMsg_New_Params params; |
189 params.parent_window = GetNativeViewId(); | 190 params.parent_window = GetNativeViewId(); |
190 params.renderer_preferences = | 191 params.renderer_preferences = |
191 delegate_->GetRendererPrefs(process()->GetBrowserContext()); | 192 delegate_->GetRendererPrefs(process()->GetBrowserContext()); |
192 params.web_preferences = delegate_->GetWebkitPrefs(); | 193 params.web_preferences = delegate_->GetWebkitPrefs(); |
193 params.view_id = routing_id(); | 194 params.view_id = routing_id(); |
| 195 params.surface_id = surface_id(); |
194 params.session_storage_namespace_id = session_storage_namespace_->id(); | 196 params.session_storage_namespace_id = session_storage_namespace_->id(); |
195 params.frame_name = frame_name; | 197 params.frame_name = frame_name; |
196 params.next_page_id = next_page_id; | 198 params.next_page_id = next_page_id; |
197 Send(new ViewMsg_New(params)); | 199 Send(new ViewMsg_New(params)); |
198 | 200 |
199 // If it's enabled, tell the renderer to set up the Javascript bindings for | 201 // If it's enabled, tell the renderer to set up the Javascript bindings for |
200 // sending messages back to the browser. | 202 // sending messages back to the browser. |
201 Send(new ViewMsg_AllowBindings(routing_id(), enabled_bindings_)); | 203 Send(new ViewMsg_AllowBindings(routing_id(), enabled_bindings_)); |
202 // Let our delegate know that we created a RenderView. | 204 // Let our delegate know that we created a RenderView. |
203 delegate_->RenderViewCreated(this); | 205 delegate_->RenderViewCreated(this); |
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 | 1540 |
1539 void RenderViewHost::OnWebUISend(const GURL& source_url, | 1541 void RenderViewHost::OnWebUISend(const GURL& source_url, |
1540 const std::string& name, | 1542 const std::string& name, |
1541 const base::ListValue& args) { | 1543 const base::ListValue& args) { |
1542 delegate_->WebUISend(this, source_url, name, args); | 1544 delegate_->WebUISend(this, source_url, name, args); |
1543 } | 1545 } |
1544 | 1546 |
1545 void RenderViewHost::ClearPowerSaveBlockers() { | 1547 void RenderViewHost::ClearPowerSaveBlockers() { |
1546 STLDeleteValues(&power_save_blockers_); | 1548 STLDeleteValues(&power_save_blockers_); |
1547 } | 1549 } |
OLD | NEW |