Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2646613002: ShowCreatedWindow: some speculative fixes for 680876. (Closed)
Patch Set: Add a CHECK Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 WebContentsView* new_view = new_contents->view_.get(); 2109 WebContentsView* new_view = new_contents->view_.get();
2110 2110
2111 // TODO(brettw): It seems bogus that we have to call this function on the 2111 // TODO(brettw): It seems bogus that we have to call this function on the
2112 // newly created object and give it one of its own member variables. 2112 // newly created object and give it one of its own member variables.
2113 new_view->CreateViewForWidget( 2113 new_view->CreateViewForWidget(
2114 new_contents->GetRenderViewHost()->GetWidget(), false); 2114 new_contents->GetRenderViewHost()->GetWidget(), false);
2115 } 2115 }
2116 // Save the created window associated with the route so we can show it 2116 // Save the created window associated with the route so we can show it
2117 // later. 2117 // later.
2118 DCHECK_NE(MSG_ROUTING_NONE, main_frame_widget_route_id); 2118 DCHECK_NE(MSG_ROUTING_NONE, main_frame_widget_route_id);
2119 CHECK(RenderWidgetHostImpl::FromID(render_process_id,
2120 main_frame_widget_route_id));
2119 pending_contents_[std::make_pair( 2121 pending_contents_[std::make_pair(
2120 render_process_id, main_frame_widget_route_id)] = new_contents; 2122 render_process_id, main_frame_widget_route_id)] = new_contents;
2121 AddDestructionObserver(new_contents); 2123 AddDestructionObserver(new_contents);
2122 } 2124 }
2123 2125
2124 if (delegate_) { 2126 if (delegate_) {
2125 delegate_->WebContentsCreated( 2127 delegate_->WebContentsCreated(
2126 this, render_process_id, params.opener_render_frame_id, 2128 this, render_process_id, params.opener_render_frame_id,
2127 params.frame_name, params.target_url, new_contents); 2129 params.frame_name, params.target_url, new_contents);
2128 } 2130 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2206 // to allow it to survive the trip without being hosted. 2208 // to allow it to survive the trip without being hosted.
2207 base::mac::NSObjectRetain(widget_view->GetNativeView()); 2209 base::mac::NSObjectRetain(widget_view->GetNativeView());
2208 #endif 2210 #endif
2209 } 2211 }
2210 2212
2211 void WebContentsImpl::ShowCreatedWindow(int process_id, 2213 void WebContentsImpl::ShowCreatedWindow(int process_id,
2212 int main_frame_widget_route_id, 2214 int main_frame_widget_route_id,
2213 WindowOpenDisposition disposition, 2215 WindowOpenDisposition disposition,
2214 const gfx::Rect& initial_rect, 2216 const gfx::Rect& initial_rect,
2215 bool user_gesture) { 2217 bool user_gesture) {
2218 RenderWidgetHostImpl* rwh =
2219 RenderWidgetHostImpl::FromID(process_id, main_frame_widget_route_id);
2220 if (!rwh)
2221 return;
alexmos 2017/01/18 23:23:47 Would it help at all to add a DumpWithoutCrashing
ncarter (slow) 2017/01/19 22:04:49 Thanks for this suggestion. I've added a DumpWitho
2216 WebContentsImpl* contents = 2222 WebContentsImpl* contents =
2217 GetCreatedWindow(process_id, main_frame_widget_route_id); 2223 GetCreatedWindow(process_id, main_frame_widget_route_id);
2218 if (contents) { 2224 if (contents && contents->GetMainFrame()->GetRenderWidgetHost() == rwh) {
alexmos 2017/01/18 23:23:47 How do you think we could get to the state where t
ncarter (slow) 2017/01/18 23:59:16 Really, I'm grasping at straws here: I don't reall
alexmos 2017/01/19 01:25:20 Agreed - an Android delegate somehow triggering a
ncarter (slow) 2017/01/19 22:04:49 I undid the equality check since I agree with you
2219 WebContentsDelegate* delegate = GetDelegate(); 2225 WebContentsDelegate* delegate = GetDelegate();
2220 contents->is_resume_pending_ = true; 2226 contents->is_resume_pending_ = true;
2221 if (!delegate || delegate->ShouldResumeRequestsForCreatedWindow()) 2227 if (!delegate || delegate->ShouldResumeRequestsForCreatedWindow())
2222 contents->ResumeLoadingCreatedWebContents(); 2228 contents->ResumeLoadingCreatedWebContents();
2223 2229
2224 if (delegate) { 2230 if (delegate) {
2225 delegate->AddNewContents(this, contents, disposition, initial_rect, 2231 delegate->AddNewContents(this, contents, disposition, initial_rect,
2226 user_gesture, NULL); 2232 user_gesture, NULL);
2227 } 2233 }
2228 2234
2229 RenderWidgetHostImpl* rwh = contents->GetMainFrame()->GetRenderWidgetHost();
2230 DCHECK_EQ(main_frame_widget_route_id, rwh->GetRoutingID());
2231 rwh->Send(new ViewMsg_Move_ACK(rwh->GetRoutingID())); 2235 rwh->Send(new ViewMsg_Move_ACK(rwh->GetRoutingID()));
2232 } 2236 }
2233 } 2237 }
2234 2238
2235 void WebContentsImpl::ShowCreatedWidget(int process_id, 2239 void WebContentsImpl::ShowCreatedWidget(int process_id,
2236 int route_id, 2240 int route_id,
2237 const gfx::Rect& initial_rect) { 2241 const gfx::Rect& initial_rect) {
2238 ShowCreatedWidget(process_id, route_id, false, initial_rect); 2242 ShowCreatedWidget(process_id, route_id, false, initial_rect);
2239 } 2243 }
2240 2244
(...skipping 3178 matching lines...) Expand 10 before | Expand all | Expand 10 after
5419 GetMainFrame()->AddMessageToConsole( 5423 GetMainFrame()->AddMessageToConsole(
5420 content::CONSOLE_MESSAGE_LEVEL_WARNING, 5424 content::CONSOLE_MESSAGE_LEVEL_WARNING,
5421 base::StringPrintf("This site does not have a valid SSL " 5425 base::StringPrintf("This site does not have a valid SSL "
5422 "certificate! Without SSL, your site's and " 5426 "certificate! Without SSL, your site's and "
5423 "visitors' data is vulnerable to theft and " 5427 "visitors' data is vulnerable to theft and "
5424 "tampering. Get a valid SSL certificate before" 5428 "tampering. Get a valid SSL certificate before"
5425 " releasing your website to the public.")); 5429 " releasing your website to the public."));
5426 } 5430 }
5427 5431
5428 } // namespace content 5432 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698