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

Side by Side Diff: Source/platform/exported/WebURLRequest.cpp

Issue 339593005: Set the target type when creating the request for main resource (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Made the setter method private Created 6 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 // The standard implementation of WebURLRequestPrivate, which maintains 65 // The standard implementation of WebURLRequestPrivate, which maintains
66 // ownership of a ResourceRequest instance. 66 // ownership of a ResourceRequest instance.
67 class WebURLRequestPrivateImpl : public WebURLRequestPrivate { 67 class WebURLRequestPrivateImpl : public WebURLRequestPrivate {
68 public: 68 public:
69 WebURLRequestPrivateImpl() 69 WebURLRequestPrivateImpl()
70 { 70 {
71 m_resourceRequest = &m_resourceRequestAllocation; 71 m_resourceRequest = &m_resourceRequestAllocation;
72 } 72 }
73 73
74 WebURLRequestPrivateImpl(const WebURL& url, bool isMainResource, bool isMain Frame)
75 {
76 if (isMainResource)
77 m_resourceRequestAllocation = ResourceRequest::createMainResourceReq uest(url, isMainFrame);
78 else
79 m_resourceRequestAllocation.setURL(url);
80 m_resourceRequest = &m_resourceRequestAllocation;
81 }
82
74 WebURLRequestPrivateImpl(const WebURLRequestPrivate* p) 83 WebURLRequestPrivateImpl(const WebURLRequestPrivate* p)
75 : m_resourceRequestAllocation(*p->m_resourceRequest) 84 : m_resourceRequestAllocation(*p->m_resourceRequest)
76 { 85 {
77 m_resourceRequest = &m_resourceRequestAllocation; 86 m_resourceRequest = &m_resourceRequestAllocation;
78 } 87 }
79 88
80 virtual void dispose() { delete this; } 89 virtual void dispose() { delete this; }
81 90
82 private: 91 private:
83 virtual ~WebURLRequestPrivateImpl() { } 92 virtual ~WebURLRequestPrivateImpl() { }
84 93
85 ResourceRequest m_resourceRequestAllocation; 94 ResourceRequest m_resourceRequestAllocation;
86 }; 95 };
87 96
97 WebURLRequest::WebURLRequest(const WebURL& url, bool isMainResource, bool isMain Frame)
98 : m_private(0)
99 {
100 assign(new WebURLRequestPrivateImpl(url, isMainResource, isMainFrame));
101 }
102
88 void WebURLRequest::initialize() 103 void WebURLRequest::initialize()
89 { 104 {
90 assign(new WebURLRequestPrivateImpl()); 105 assign(new WebURLRequestPrivateImpl());
91 } 106 }
92 107
93 void WebURLRequest::reset() 108 void WebURLRequest::reset()
94 { 109 {
95 assign(0); 110 assign(0);
96 } 111 }
97 112
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 // Subclasses may call this directly so a self-assignment check is needed 355 // Subclasses may call this directly so a self-assignment check is needed
341 // here as well as in the public assign method. 356 // here as well as in the public assign method.
342 if (m_private == p) 357 if (m_private == p)
343 return; 358 return;
344 if (m_private) 359 if (m_private)
345 m_private->dispose(); 360 m_private->dispose();
346 m_private = p; 361 m_private = p;
347 } 362 }
348 363
349 } // namespace blink 364 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698