Closed
Bug 1053563
Opened 10 years ago
Closed 9 years ago
Replace ::InitWith methods in TextureClient implemenations by static construction methods.
Categories
(Core :: Graphics: Layers, defect)
Core
Graphics: Layers
Tracking
()
RESOLVED
FIXED
mozilla40
Tracking | Status | |
---|---|---|
firefox40 | --- | fixed |
People
(Reporter: nical, Assigned: ethlin, Mentored)
References
Details
Attachments
(1 file, 1 obsolete file)
20.11 KB,
patch
|
nical
:
review+
|
Details | Diff | Splinter Review |
Following up on the stuff that went in bug 1027601
Reporter | ||
Updated•10 years ago
|
Mentor: nical.bugzilla
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → etlin
Assignee | ||
Comment 1•9 years ago
|
||
I search all InitWidth functions and move them to the constructor. Is that right?
Attachment #8599006 -
Flags: review?(nical.bugzilla)
Reporter | ||
Comment 2•9 years ago
|
||
(In reply to Ethan Lin[:elin] from comment #1) > Created attachment 8599006 [details] [diff] [review] > Move all InitWidth to constructor > > I search all InitWidth functions and move them to the constructor. Is that > right? Not constructors, be static methods instead. The idea is that there are many reasons for a texture allocation to fail so we want to be able to do: RefPtr<TextureClient> texture = TextureClientFooBar::Create(size, format, ...); if (!texture) { // handle failure case } Instead of: RefPtr<TextureClient> texture = new TextureClientFooBar(...); if (!texture->Allocate(...)) { texture = nullptr; } The goal is to avoid making it possible to hold on to a texture that we failed to allocate (and it makes the API slightly nicer). For example, see https://bugzilla.mozilla.org/attachment.cgi?id=8444125&action=diff
Reporter | ||
Comment 3•9 years ago
|
||
Comment on attachment 8599006 [details] [diff] [review] Move all InitWidth to constructor Review of attachment 8599006 [details] [diff] [review]: ----------------------------------------------------------------- Constructors don't let you handle failure cases gracefully. Please use a static method which internally calls the constructor, and only return a non-null texture if the allocation was successful.
Attachment #8599006 -
Flags: review?(nical.bugzilla) → review-
Assignee | ||
Comment 4•9 years ago
|
||
(In reply to Nicolas Silva [:nical] from comment #3) > Comment on attachment 8599006 [details] [diff] [review] > Move all InitWidth to constructor > > Review of attachment 8599006 [details] [diff] [review]: > ----------------------------------------------------------------- > > Constructors don't let you handle failure cases gracefully. Please use a > static method which internally calls the constructor, and only return a > non-null texture if the allocation was successful. I see. I will upload another patch to do this.
Assignee | ||
Comment 5•9 years ago
|
||
I create a static function for the TextureClient which has InitWith function. There is no caller of GrallocTextureClient's InitWith, so I remove it.
Attachment #8599006 -
Attachment is obsolete: true
Attachment #8599656 -
Flags: review?(nical.bugzilla)
Reporter | ||
Updated•9 years ago
|
Attachment #8599656 -
Flags: review?(nical.bugzilla) → review+
Assignee | ||
Comment 6•9 years ago
|
||
The tryserver result: https://treeherder.mozilla.org/#/jobs?repo=try&revision=a1567825e97e
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/0241a6b50e7b
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox40:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in
before you can comment on or make changes to this bug.
Description
•