WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
75848
[EFL] Replace malloc/calloc/free to new/delete
https://bugs.webkit.org/show_bug.cgi?id=75848
Summary
[EFL] Replace malloc/calloc/free to new/delete
Tomasz Morawski
Reported
2012-01-09 05:48:57 PST
Replace malloc/calloc/free functions calls to new/delete operator calls
Attachments
First patch
(30.50 KB, patch)
2012-01-27 08:15 PST
,
Tomasz Morawski
rakuco
: review-
Details
Formatted Diff
Diff
Next patch
(29.95 KB, patch)
2012-02-27 06:47 PST
,
Tomasz Morawski
no flags
Details
Formatted Diff
Diff
Fixed Raphael's comment
(30.00 KB, patch)
2012-02-28 00:00 PST
,
Tomasz Morawski
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2012-01-09 10:08:04 PST
We shouldn't just blindly do that, see e.g.
bug 45735
. What specific instances of malloc/free would you like to change?
Alexey Proskuryakov
Comment 2
2012-01-09 10:08:25 PST
Or is this only about WebKit EFL layer, not WebCore?
Gyuyoung Kim
Comment 3
2012-01-09 17:45:21 PST
(In reply to
comment #2
)
> Or is this only about WebKit EFL layer, not WebCore?
AFAIK, this patch will focus on EFL layer. He will add [EFL] to Bug title.
Tomasz Morawski
Comment 4
2012-01-09 23:24:16 PST
(In reply to
comment #2
)
> Or is this only about WebKit EFL layer, not WebCore?
Yes, it is EFL only. I am sorry for confusion. :)
Gyuyoung Kim
Comment 5
2012-01-25 22:21:12 PST
Any update ?
Tomasz Morawski
Comment 6
2012-01-25 23:27:03 PST
(In reply to
comment #5
)
> Any update ?
I am working on it.
Tomasz Morawski
Comment 7
2012-01-27 08:15:49 PST
Created
attachment 124320
[details]
First patch This patch: - does not change ewk_js file due to that changes for this file are very big. I would like to show this changes in separate patch for this bug or open a new bug. - does not change realloc operations (separate patch will be prepared).
Gyuyoung Kim
Comment 8
2012-01-30 00:13:10 PST
Comment on
attachment 124320
[details]
First patch View in context:
https://bugs.webkit.org/attachment.cgi?id=124320&action=review
> Source/WebKit/efl/ewk/ewk_tiled_model.cpp:675 > + tileUnusedCache->entries.count--;
I think this code should be reviewed by backing store guys.
Tomasz Morawski
Comment 9
2012-02-01 07:14:30 PST
(In reply to
comment #8
)
> (From update of
attachment 124320
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=124320&action=review
> > > Source/WebKit/efl/ewk/ewk_tiled_model.cpp:675 > > + tileUnusedCache->entries.count--; > > I think this code should be reviewed by backing store guys.
It is a very simple change. Patch looks very bad only.
Gyuyoung Kim
Comment 10
2012-02-26 18:12:39 PST
Comment on
attachment 124320
[details]
First patch View in context:
https://bugs.webkit.org/attachment.cgi?id=124320&action=review
>>> Source/WebKit/efl/ewk/ewk_tiled_model.cpp:675 >>> + tileUnusedCache->entries.count--; >> >> I think this code should be reviewed by backing store guys. > > It is a very simple change. Patch looks very bad only.
Ok, it looks this patch almost good. If jungjik and Kwanghyuk agree with this patch, this patch is r+ informally. I think we need to land this patch for EFL port's code quality. Jungjik and Kwanghyuk, could you review this patch?
Raphael Kubo da Costa (:rakuco)
Comment 11
2012-02-26 18:54:30 PST
Comment on
attachment 124320
[details]
First patch View in context:
https://bugs.webkit.org/attachment.cgi?id=124320&action=review
Looks good overall, but there are some minor things to work out and you need to rebase it.
> Source/WebKit/efl/ewk/ewk_history.cpp:251 > + item->title = 0; > + item->alternateTitle = 0; > + item->uri = 0; > + item->originalUri = 0;
How about memset(item, 0, sizeof(*item)) before setting core?
> Source/WebKit/efl/ewk/ewk_tiled_backing_store.cpp:478 > + OwnPtr<Ewk_Tiled_Backing_Store_Item> item = adoptPtr(new Ewk_Tiled_Backing_Store_Item);
It's safer to #include <OwnPtr.h> in this file.
> Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp:202 > + OwnPtr<Ewk_Tile_Matrix> tileMatrix = WTF::adoptPtr(new Ewk_Tile_Matrix);
PassOwnPtr.h adds a "using WTF::adoptPtr()" clause, so you can use just adoptPtr the same way you use just OwnPtr.
> Source/WebKit/efl/ewk/ewk_view.cpp:641 > + priv->settings.encodingDefault = eina_stringshare_add(priv->pageSettings->defaultTextEncodingName().utf8().data());
I'd rather not commit unrelated changes in this patch.
JungJik Lee
Comment 12
2012-02-26 20:30:14 PST
(In reply to
comment #10
)
> (From update of
attachment 124320
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=124320&action=review
> > >>> Source/WebKit/efl/ewk/ewk_tiled_model.cpp:675 > >>> + tileUnusedCache->entries.count--; > >> > >> I think this code should be reviewed by backing store guys. > > > > It is a very simple change. Patch looks very bad only. > > Ok, it looks this patch almost good. If jungjik and Kwanghyuk agree with this patch, this patch is r+ informally. > I think we need to land this patch for EFL port's code quality. > > Jungjik and Kwanghyuk, could you review this patch?
This part of the code is okay. I think the logic is the same.
Tomasz Morawski
Comment 13
2012-02-27 06:47:22 PST
Created
attachment 129031
[details]
Next patch Fixed Raphael's comments. Additional change: I had to left malloc for Ewk_Tile object due to compilation error when "new" was used: Source/WebKit/efl/ewk/ewk_tiled_model.cpp:189:16: error: uninitialized const member in ‘Ewk_Tile {aka struct _Ewk_Tile}’ using ‘new’ without new-initializer [-fpermissive] Source/WebKit/efl/ewk/ewk_tiled_backing_store.h:71:22: note: ‘_Ewk_Tile::width’ should be initialized Anyway, initialization of const fileds in Ewk_Tile looks very ugly. Do you have any good idea to fix this without use of base C++ features like constructor or private section?
Raphael Kubo da Costa (:rakuco)
Comment 14
2012-02-27 15:05:51 PST
Comment on
attachment 129031
[details]
Next patch View in context:
https://bugs.webkit.org/attachment.cgi?id=129031&action=review
> Source/WebKit/efl/ewk/ewk_tiled_backing_store.cpp:29 > +#include <OwnPtr.h>
You also need PassOwnPtr.h for the implementation of adoptPtr().
Raphael Kubo da Costa (:rakuco)
Comment 15
2012-02-27 15:10:03 PST
(In reply to
comment #13
)
> Anyway, initialization of const fileds in Ewk_Tile looks very ugly. Do you have any good idea to fix this without use of base C++ features like constructor or private section?
Nope.
Tomasz Morawski
Comment 16
2012-02-28 00:00:02 PST
Created
attachment 129201
[details]
Fixed Raphael's comment
Tomasz Morawski
Comment 17
2012-02-28 00:01:37 PST
(In reply to
comment #15
)
> (In reply to
comment #13
) > > Anyway, initialization of const fileds in Ewk_Tile looks very ugly. Do you have any good idea to fix this without use of base C++ features like constructor or private section? > > Nope.
Maybe it is a good point to find a good solution for this and future similar "issues"?
Raphael Kubo da Costa (:rakuco)
Comment 18
2012-02-28 04:36:31 PST
Comment on
attachment 129201
[details]
Fixed Raphael's comment It finally looks OK to me :)
Tomasz Morawski
Comment 19
2012-02-28 23:50:55 PST
(In reply to
comment #18
)
> (From update of
attachment 129201
[details]
) > It finally looks OK to me :)
Thanks for infomal review. :)
Hajime Morrita
Comment 20
2012-02-29 00:05:29 PST
Comment on
attachment 129201
[details]
Fixed Raphael's comment I hope these new-allocated structs have a constructor instead of memeset()-ed...
Tomasz Morawski
Comment 21
2012-02-29 00:23:03 PST
(In reply to
comment #20
)
> (From update of
attachment 129201
[details]
) > I hope these new-allocated structs have a constructor instead of memeset()-ed...
Currently, fileds are initialized when it is needed in functions that creates object and this patch doesn't changed this way. IMO, missing simple constructor that initialize structure fields could be an issue in EFL port.
WebKit Review Bot
Comment 22
2012-02-29 00:58:44 PST
Comment on
attachment 129201
[details]
Fixed Raphael's comment Clearing flags on attachment: 129201 Committed
r109205
: <
http://trac.webkit.org/changeset/109205
>
WebKit Review Bot
Comment 23
2012-02-29 00:58:50 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug