Request To Delete WebURLResponse::initialize

14 views
Skip to first unread message

Adam Rice

unread,
Jun 30, 2016, 11:20:24 PM6/30/16
to blink-dev
I'd like to remove blink::WebURLResponse::initialize() and just allocate m_private in the constructor.

My justification is that I keep forgetting to call initialize() and I SEGV.

Any objections?

While I'm at it I'd like to use a unique_ptr for m_private since the class devotes a non-zero number of lines to emulating unique_ptr semantics. Is this controversial?

Both these changes imply making the constructor and destructor out-of-line. This should have no performance implications: currently you need to call the out-of-line initialize() method before the class will do anything useful, and the destructor just calls the out-of-line reset() method.

Adam Barth

unread,
Jun 30, 2016, 11:25:32 PM6/30/16
to Adam Rice, blink-dev
On Thu, Jun 30, 2016 at 8:20 PM 'Adam Rice' via blink-dev <blin...@chromium.org> wrote:
I'd like to remove blink::WebURLResponse::initialize() and just allocate m_private in the constructor.

My justification is that I keep forgetting to call initialize() and I SEGV.

Any objections?

While I'm at it I'd like to use a unique_ptr for m_private since the class devotes a non-zero number of lines to emulating unique_ptr semantics. Is this controversial?

The goofy unique_ptr emulation dates from a time before unique_ptr existed.  :)

Adam

Daniel Cheng

unread,
Jun 30, 2016, 11:47:51 PM6/30/16
to Adam Barth, Adam Rice, blink-dev
That seems reasonable to me: I assume we'll keep the current behavior that a default-constructed WebURLResponse will be considered null, right?

Daniel

Adam Rice

unread,
Jul 1, 2016, 1:06:06 AM7/1/16
to Daniel Cheng, Adam Barth, blink-dev
I must admit I failed to spot the isNull() method. The semantics won't change. In a quick scan of uses I only found one place where the ability to cheaply construct a null instance might be important: PepperPluginInstanceImpl. My impression is that even there it won't make a significant difference.

Darin Fisher

unread,
Jul 1, 2016, 2:07:04 AM7/1/16
to Adam Rice, Daniel Cheng, Adam Barth, blink-dev

This change makes sense. What Adam said. WebURLRequest could benefit from the same change. There are a bunch others too, IIRC.

-Darin

Kinuko Yasuda

unread,
Jul 1, 2016, 3:15:38 AM7/1/16
to Darin Fisher, Adam Rice, Daniel Cheng, Adam Barth, blink-dev
Sounds reasonable to me too.  Looks like at least WebURLRequest, WebURLLoadTiming, WebHTTPBody seem to have same/similar code pattern.
Reply all
Reply to author
Forward
0 new messages