[Webkit-unassigned] [Bug 96201] [EFL][WK2] WKEinaSharedString needs a function to adopt eina stringshare.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 10 03:12:19 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=96201





--- Comment #13 from Mikhail Pozdnyakov <mikhail.pozdnyakov at intel.com>  2012-09-10 03:12:36 PST ---
(In reply to comment #12)
> (In reply to comment #11)
> > > > Is it ok to use WKAdoptTag (adoptWK) for eina_stringshare even if it is not a WK api object?
> > > 
> > > I think yes, unless we want to introduce our own tag, I would use existing
> > > one..
> I think using WKAdoptTag for eina_stringshare can make human mistakes or misunderstanding, because some related template functions and class (e.g. WKRetainPtr, adoptWK()...) are also opened by cpp apis.
> 
> If a constructor uses WKAdoptTag for adopting eina_stringshare, api user can try to use adoptWK() function for eina_stringshare, because it already used in the header file.
> 
> How about your opinion?
> 
> > Another option is to add a new static member like 'static WKEinaSharedString fromEinaStringShare(Eina_Stringshare*);'
> Ok, I think this is the issue about static function and friend function.
> 
> I also thought about this, and followed the way that adoptPtr() or adoptRef() is designed because it is slightly easy for api users.
> 
> With static function,
> create sharedstring by adoption will be as below
> WKEinaSharedString string = WKEinaSharedString::fromEinaStringShare(eina_stringshare_add(testString))
> 
> And with friend function,
> create sharedstring by adoption will be as below
> WKEinaSharedString string = adoptEinaStringShare(eina_stringshare_add(testString))
> 
> after we added below line in the header file.
> + using WebKit::adoptEinaStringShare(...);
> 
> I prefer the second personally (for an api user), but If there is some reason that this should be a static function, I'll change it.
> 
> Thanks for your comments :)
I would personally go with static function approach, as it looks more explicit for me and produces better-looking code.. But let's see what reviewers will tell. We could think also about how to to make the method name shorter, what about WKEinaSharedString::adopt() ?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list