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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 924843002: Fix for possible crashes due to pointer value being null (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing review comments Created 5 years, 10 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 | « content/browser/accessibility/accessibility_ui.cc ('k') | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 const size_t kExtraCharsBeforeAndAfterSelection = 100; 221 const size_t kExtraCharsBeforeAndAfterSelection = 100;
222 222
223 typedef std::map<int, RenderFrameImpl*> RoutingIDFrameMap; 223 typedef std::map<int, RenderFrameImpl*> RoutingIDFrameMap;
224 static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map = 224 static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map =
225 LAZY_INSTANCE_INITIALIZER; 225 LAZY_INSTANCE_INITIALIZER;
226 226
227 typedef std::map<blink::WebFrame*, RenderFrameImpl*> FrameMap; 227 typedef std::map<blink::WebFrame*, RenderFrameImpl*> FrameMap;
228 base::LazyInstance<FrameMap> g_frame_map = LAZY_INSTANCE_INITIALIZER; 228 base::LazyInstance<FrameMap> g_frame_map = LAZY_INSTANCE_INITIALIZER;
229 229
230 int64 ExtractPostId(const WebHistoryItem& item) { 230 int64 ExtractPostId(HistoryEntry* entry) {
231 if (item.isNull()) 231 if (!entry)
232 return -1; 232 return -1;
233 233
234 if (item.httpBody().isNull()) 234 const WebHistoryItem& item = entry->root();
235 if (item.isNull() || item.httpBody().isNull())
235 return -1; 236 return -1;
236 237
237 return item.httpBody().identifier(); 238 return item.httpBody().identifier();
238 } 239 }
239 240
240 WebURLResponseExtraDataImpl* GetExtraDataFromResponse( 241 WebURLResponseExtraDataImpl* GetExtraDataFromResponse(
241 const WebURLResponse& response) { 242 const WebURLResponse& response) {
242 return static_cast<WebURLResponseExtraDataImpl*>(response.extraData()); 243 return static_cast<WebURLResponseExtraDataImpl*>(response.extraData());
243 } 244 }
244 245
(...skipping 3522 matching lines...) Expand 10 before | Expand all | Expand 10 after
3767 params.transition = ui::PageTransitionFromInt( 3768 params.transition = ui::PageTransitionFromInt(
3768 params.transition | ui::PAGE_TRANSITION_CLIENT_REDIRECT); 3769 params.transition | ui::PAGE_TRANSITION_CLIENT_REDIRECT);
3769 } else { 3770 } else {
3770 params.referrer = RenderViewImpl::GetReferrerFromRequest( 3771 params.referrer = RenderViewImpl::GetReferrerFromRequest(
3771 frame, ds->request()); 3772 frame, ds->request());
3772 } 3773 }
3773 3774
3774 base::string16 method = request.httpMethod(); 3775 base::string16 method = request.httpMethod();
3775 if (EqualsASCII(method, "POST")) { 3776 if (EqualsASCII(method, "POST")) {
3776 params.is_post = true; 3777 params.is_post = true;
3777 params.post_id = ExtractPostId(entry->root()); 3778 params.post_id = ExtractPostId(entry);
3778 } 3779 }
3779 3780
3780 // Send the user agent override back. 3781 // Send the user agent override back.
3781 params.is_overriding_user_agent = internal_data->is_overriding_user_agent(); 3782 params.is_overriding_user_agent = internal_data->is_overriding_user_agent();
3782 3783
3783 // Track the URL of the original request. We use the first entry of the 3784 // Track the URL of the original request. We use the first entry of the
3784 // redirect chain if it exists because the chain may have started in another 3785 // redirect chain if it exists because the chain may have started in another
3785 // process. 3786 // process.
3786 params.original_request_url = GetOriginalRequestURL(ds); 3787 params.original_request_url = GetOriginalRequestURL(ds);
3787 3788
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
4439 4440
4440 #if defined(ENABLE_BROWSER_CDMS) 4441 #if defined(ENABLE_BROWSER_CDMS)
4441 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 4442 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
4442 if (!cdm_manager_) 4443 if (!cdm_manager_)
4443 cdm_manager_ = new RendererCdmManager(this); 4444 cdm_manager_ = new RendererCdmManager(this);
4444 return cdm_manager_; 4445 return cdm_manager_;
4445 } 4446 }
4446 #endif // defined(ENABLE_BROWSER_CDMS) 4447 #endif // defined(ENABLE_BROWSER_CDMS)
4447 4448
4448 } // namespace content 4449 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/accessibility_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698