Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Maciej Stachowiak

Perhaps we should document this in the coding style guidelines. I like 
consistency and static member function seems like a good way to go, 
particularly since it matches the Class::create() pattern we often use for 
non-singletons.

 On Jan 28, 2015, at 12:10 PM, Ryosuke Niwa rn...@webkit.org wrote:
 
 Class::shared() pattern seems good to me.
 
 - R. Niwa
 
 On Wed, Jan 28, 2015 at 11:38 AM, Benjamin Poulain benja...@webkit.org 
 mailto:benja...@webkit.org wrote:
 IMHO, scoping the function by its class is cleaner.
 http://trac.webkit.org/changeset/179247 
 http://trac.webkit.org/changeset/179247 looks like an improvement to me.
 
 Benjamin
 
 
 On 1/28/15 11:30 AM, Chris Dumez wrote:
 Hi,
 
 I noticed that we are currently not very consistent in WebKit in the way we 
 implement singleton classes instance getters.
 - Some classes use free functions (like MemoryCache, and PageCache until I 
 updated it yesterday). e.g. memoryCache().xxx()
 - Some classes are using static functions in the class (e.g. 
 DatabaseProcess::shared(), PluginProcess::shared()).
 
 As I said, I landed a patch yesterday so that the global page cache is now 
 accessed via PageCache::shared() because I thought this was the currently 
 preferred pattern (given it seems very common in WebKit2 code).
 However, I thought I would email webkit-dev to make sure this is actually 
 the case and make sure we agree on a given pattern (one way or another) for 
 current and future code. We could then maybe document this
 as part of our coding style.
 
 Any feedback on this matter?
 
 Kr,
 --
 Chris Dumez - Apple Inc.
 Cupertino, CA
 
 
 
 
 
 
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org mailto:webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev 
 https://lists.webkit.org/mailman/listinfo/webkit-dev
 
 
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org mailto:webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev 
 https://lists.webkit.org/mailman/listinfo/webkit-dev
 
 
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Darin Adler
I like the economy of the smaller non-member function name; it seems overly 
wordy to be constantly stating the class name as well as the nearly meaningless 
word “shared”. I think the word “shared” is what I like least about the member 
function approach.

It had always thought that we used static member functions for this to 
replicate the pattern from Objective-C, and it seems more idiomatic modern C++ 
to use a free function for this kind of thing.

Maciej’s point about Class::create() might be enough to convince me to change 
my view, though; it’s hard to see any reason the same logic wouldn’t apply in 
that case.

— Darin
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Gavin Barraclough
Gotta say, ‘singleton’ seems like a really good name for singletons.

G.

 On Jan 28, 2015, at 7:06 PM, Filip Pizlo fpi...@apple.com wrote:
 
 This is shorter: Class::singleton()
 
 It's also more consistent with the rest of our style (we usually don't put 
 get in getter names). 
 
 -Filip
 
 On Jan 28, 2015, at 6:11 PM, Maciej Stachowiak m...@apple.com wrote:
 
 
 On Jan 28, 2015, at 4:28 PM, Darin Adler da...@apple.com wrote:
 
 I like the economy of the smaller non-member function name; it seems overly 
 wordy to be constantly stating the class name as well as the nearly 
 meaningless word “shared”. I think the word “shared” is what I like least 
 about the member function approach.
 
 It had always thought that we used static member functions for this to 
 replicate the pattern from Objective-C, and it seems more idiomatic modern 
 C++ to use a free function for this kind of thing.
 
 Maciej’s point about Class::create() might be enough to convince me to 
 change my view, though; it’s hard to see any reason the same logic wouldn’t 
 apply in that case.
 
 I would also find it acceptable to use free functions for all these cases. 
 Mostly it bugs me for them to be different - the singleton case is rarer, so 
 it seems odd to treat it as especially conciseness-worthy.
 
 Yet another possibility is finding a better name than ‘shared’ for the 
 singleton pattern function, but I don’t have any better ideas. 
 Class::getSingleton() is more explicit but the extra verbosity doesn’t seem 
 helpful to me.
 
 Regards,
 Maciej
 
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Yong Li
Class::unique() is one of the known names for singletons

Yong Li

From: Maciej Stachowiakmailto:m...@apple.com
Sent: ‎1/‎28/‎2015 9:11 PM
To: Darin Adlermailto:da...@apple.com
Cc: WebKit Developmentmailto:webkit-dev@lists.webkit.org
Subject: Re: [webkit-dev] Pattern for singleton classes instance getters


 On Jan 28, 2015, at 4:28 PM, Darin Adler da...@apple.com wrote:

 I like the economy of the smaller non-member function name; it seems overly 
 wordy to be constantly stating the class name as well as the nearly 
 meaningless word “shared”. I think the word “shared” is what I like least 
 about the member function approach.

 It had always thought that we used static member functions for this to 
 replicate the pattern from Objective-C, and it seems more idiomatic modern 
 C++ to use a free function for this kind of thing.

 Maciej’s point about Class::create() might be enough to convince me to change 
 my view, though; it’s hard to see any reason the same logic wouldn’t apply in 
 that case.

I would also find it acceptable to use free functions for all these cases. 
Mostly it bugs me for them to be different - the singleton case is rarer, so it 
seems odd to treat it as especially conciseness-worthy.

Yet another possibility is finding a better name than ‘shared’ for the 
singleton pattern function, but I don’t have any better ideas. 
Class::getSingleton() is more explicit but the extra verbosity doesn’t seem 
helpful to me.

Regards,
Maciej

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Filip Pizlo
This is shorter: Class::singleton()

It's also more consistent with the rest of our style (we usually don't put 
get in getter names). 

-Filip

 On Jan 28, 2015, at 6:11 PM, Maciej Stachowiak m...@apple.com wrote:
 
 
 On Jan 28, 2015, at 4:28 PM, Darin Adler da...@apple.com wrote:
 
 I like the economy of the smaller non-member function name; it seems overly 
 wordy to be constantly stating the class name as well as the nearly 
 meaningless word “shared”. I think the word “shared” is what I like least 
 about the member function approach.
 
 It had always thought that we used static member functions for this to 
 replicate the pattern from Objective-C, and it seems more idiomatic modern 
 C++ to use a free function for this kind of thing.
 
 Maciej’s point about Class::create() might be enough to convince me to 
 change my view, though; it’s hard to see any reason the same logic wouldn’t 
 apply in that case.
 
 I would also find it acceptable to use free functions for all these cases. 
 Mostly it bugs me for them to be different - the singleton case is rarer, so 
 it seems odd to treat it as especially conciseness-worthy.
 
 Yet another possibility is finding a better name than ‘shared’ for the 
 singleton pattern function, but I don’t have any better ideas. 
 Class::getSingleton() is more explicit but the extra verbosity doesn’t seem 
 helpful to me.
 
 Regards,
 Maciej
 
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Maciej Stachowiak

 On Jan 28, 2015, at 4:28 PM, Darin Adler da...@apple.com wrote:
 
 I like the economy of the smaller non-member function name; it seems overly 
 wordy to be constantly stating the class name as well as the nearly 
 meaningless word “shared”. I think the word “shared” is what I like least 
 about the member function approach.
 
 It had always thought that we used static member functions for this to 
 replicate the pattern from Objective-C, and it seems more idiomatic modern 
 C++ to use a free function for this kind of thing.
 
 Maciej’s point about Class::create() might be enough to convince me to change 
 my view, though; it’s hard to see any reason the same logic wouldn’t apply in 
 that case.

I would also find it acceptable to use free functions for all these cases. 
Mostly it bugs me for them to be different - the singleton case is rarer, so it 
seems odd to treat it as especially conciseness-worthy.

Yet another possibility is finding a better name than ‘shared’ for the 
singleton pattern function, but I don’t have any better ideas. 
Class::getSingleton() is more explicit but the extra verbosity doesn’t seem 
helpful to me.

Regards,
Maciej

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Michael Catanzaro
On Wed, Jan 28, 2015 at 8:11 PM, Maciej Stachowiak m...@apple.com 
wrote:
Yet another possibility is finding a better name than ‘shared’ 
for the singleton pattern function, but I don’t have any better 
ideas. Class::getSingleton() is more explicit but the extra verbosity 
doesn’t seem helpful to me.


I recommend Class::instance(), which is what I've seen used almost 
exclusively outside of WebKit. It's what Scott Meyers used, and it's 
very similar to the Gang of Four's choice of Class::Instance() and the 
Java pattern Class.INSTANCE.


That said, Class::singleton() is very attractive too.

I've never seen Class::shared() used anywhere except WebKit. The first 
time I saw this I had no clue what it was until I looked up the 
implementation.


All of these can get quite annoying to type, especially when the name 
of the class is long. (Sometimes I will keep a reference to the 
instance in a local variable with a shorter name.) But I think they're 
easier to read than free functions, and we should optimize for reading 
code, not writing it. Not a big deal either way.
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Filip Pizlo

 On Jan 28, 2015, at 8:44 PM, Michael Catanzaro mcatanz...@igalia.com wrote:
 
 On Wed, Jan 28, 2015 at 8:11 PM, Maciej Stachowiak m...@apple.com wrote:
 Yet another possibility is finding a better name than ‘shared’ for the 
 singleton pattern function, but I don’t have any better ideas. 
 Class::getSingleton() is more explicit but the extra verbosity doesn’t seem 
 helpful to me.
 
 I recommend Class::instance(), which is what I've seen used almost 
 exclusively outside of WebKit. It's what Scott Meyers used, and it's very 
 similar to the Gang of Four's choice of Class::Instance() and the Java 
 pattern Class.INSTANCE.

I've seen this, also.  It's a good name.

 
 That said, Class::singleton() is very attractive too.

:-)

 
 I've never seen Class::shared() used anywhere except WebKit. The first time I 
 saw this I had no clue what it was until I looked up the implementation.

+1

 
 All of these can get quite annoying to type, especially when the name of the 
 class is long. (Sometimes I will keep a reference to the instance in a local 
 variable with a shorter name.) But I think they're easier to read than free 
 functions, and we should optimize for reading code, not writing it. Not a big 
 deal either way.
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Chris Dumez
Yes, instance() is what I’ve seen mostly outside WebKit as well. This would be 
my preference.

Kr,
--
Chris Dumez - Apple Inc.
Cupertino, CA

 On Jan 28, 2015, at 8:44 PM, Michael Catanzaro mcatanz...@igalia.com wrote:
 
 On Wed, Jan 28, 2015 at 8:11 PM, Maciej Stachowiak m...@apple.com wrote:
 Yet another possibility is finding a better name than ‘shared’ for the 
 singleton pattern function, but I don’t have any better ideas. 
 Class::getSingleton() is more explicit but the extra verbosity doesn’t seem 
 helpful to me.
 
 I recommend Class::instance(), which is what I've seen used almost 
 exclusively outside of WebKit. It's what Scott Meyers used, and it's very 
 similar to the Gang of Four's choice of Class::Instance() and the Java 
 pattern Class.INSTANCE.
 
 That said, Class::singleton() is very attractive too.
 
 I've never seen Class::shared() used anywhere except WebKit. The first time I 
 saw this I had no clue what it was until I looked up the implementation.
 
 All of these can get quite annoying to type, especially when the name of the 
 class is long. (Sometimes I will keep a reference to the instance in a local 
 variable with a shorter name.) But I think they're easier to read than free 
 functions, and we should optimize for reading code, not writing it. Not a big 
 deal either way.
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Maciej Stachowiak

This may be a question of what jargon we’ve encountered, but to me, “singleton 
clearly means the one unique instance of this class while “instance means 
any instance of this class. If I hadn’t seen this thread, I would interpret 
Class::instance() to mean “create a brand new instance of this class” rather 
than “return the unique singleton instance of this class, creating if 
necessary.

Regards,
Maciej

 On Jan 28, 2015, at 8:54 PM, Chris Dumez cdu...@apple.com wrote:
 
 Yes, instance() is what I’ve seen mostly outside WebKit as well. This would 
 be my preference.
 
 Kr,
 --
 Chris Dumez - Apple Inc.
 Cupertino, CA
 
 On Jan 28, 2015, at 8:44 PM, Michael Catanzaro mcatanz...@igalia.com 
 mailto:mcatanz...@igalia.com wrote:
 
 On Wed, Jan 28, 2015 at 8:11 PM, Maciej Stachowiak m...@apple.com 
 mailto:m...@apple.com wrote:
 Yet another possibility is finding a better name than ‘shared’ for the 
 singleton pattern function, but I don’t have any better ideas. 
 Class::getSingleton() is more explicit but the extra verbosity doesn’t seem 
 helpful to me.
 
 I recommend Class::instance(), which is what I've seen used almost 
 exclusively outside of WebKit. It's what Scott Meyers used, and it's very 
 similar to the Gang of Four's choice of Class::Instance() and the Java 
 pattern Class.INSTANCE.
 
 That said, Class::singleton() is very attractive too.
 
 I've never seen Class::shared() used anywhere except WebKit. The first time 
 I saw this I had no clue what it was until I looked up the implementation.
 
 All of these can get quite annoying to type, especially when the name of the 
 class is long. (Sometimes I will keep a reference to the instance in a local 
 variable with a shorter name.) But I think they're easier to read than free 
 functions, and we should optimize for reading code, not writing it. Not a 
 big deal either way.
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org mailto:webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev
 

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Chris Dumez
Fair enough, singleton() is very explicit indeed. I would be happy with this 
naming too.

--
Chris Dumez - Apple Inc.
Cupertino, CA

 On Jan 28, 2015, at 9:19 PM, Maciej Stachowiak m...@apple.com wrote:
 
 
 This may be a question of what jargon we’ve encountered, but to me, 
 “singleton clearly means the one unique instance of this class while 
 “instance means any instance of this class. If I hadn’t seen this thread, 
 I would interpret Class::instance() to mean “create a brand new instance of 
 this class” rather than “return the unique singleton instance of this class, 
 creating if necessary.
 
 Regards,
 Maciej
 
 On Jan 28, 2015, at 8:54 PM, Chris Dumez cdu...@apple.com 
 mailto:cdu...@apple.com wrote:
 
 Yes, instance() is what I’ve seen mostly outside WebKit as well. This would 
 be my preference.
 
 Kr,
 --
 Chris Dumez - Apple Inc.
 Cupertino, CA
 
 On Jan 28, 2015, at 8:44 PM, Michael Catanzaro mcatanz...@igalia.com 
 mailto:mcatanz...@igalia.com wrote:
 
 On Wed, Jan 28, 2015 at 8:11 PM, Maciej Stachowiak m...@apple.com 
 mailto:m...@apple.com wrote:
 Yet another possibility is finding a better name than ‘shared’ for the 
 singleton pattern function, but I don’t have any better ideas. 
 Class::getSingleton() is more explicit but the extra verbosity doesn’t 
 seem helpful to me.
 
 I recommend Class::instance(), which is what I've seen used almost 
 exclusively outside of WebKit. It's what Scott Meyers used, and it's very 
 similar to the Gang of Four's choice of Class::Instance() and the Java 
 pattern Class.INSTANCE.
 
 That said, Class::singleton() is very attractive too.
 
 I've never seen Class::shared() used anywhere except WebKit. The first time 
 I saw this I had no clue what it was until I looked up the implementation.
 
 All of these can get quite annoying to type, especially when the name of 
 the class is long. (Sometimes I will keep a reference to the instance in a 
 local variable with a shorter name.) But I think they're easier to read 
 than free functions, and we should optimize for reading code, not writing 
 it. Not a big deal either way.
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org mailto:webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev 
 https://lists.webkit.org/mailman/listinfo/webkit-dev
 
 

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Timothy Hatcher
Yeah, that is exactly what I was thinking. Instance does not imply only one 
like singleton does. Call a singleton a singleton, we have a word for it.

— Timothy Hatcher

 On Jan 28, 2015, at 9:19 PM, Maciej Stachowiak m...@apple.com wrote:
 
 This may be a question of what jargon we’ve encountered, but to me, 
 “singleton clearly means the one unique instance of this class while 
 “instance means any instance of this class. If I hadn’t seen this thread, 
 I would interpret Class::instance() to mean “create a brand new instance of 
 this class” rather than “return the unique singleton instance of this class, 
 creating if necessary.
 
 Regards,
 Maciej
 
 On Jan 28, 2015, at 8:54 PM, Chris Dumez cdu...@apple.com wrote:
 
 Yes, instance() is what I’ve seen mostly outside WebKit as well. This would 
 be my preference.
 
 Kr,
 --
 Chris Dumez - Apple Inc.
 Cupertino, CA
 
 On Jan 28, 2015, at 8:44 PM, Michael Catanzaro mcatanz...@igalia.com 
 wrote:
 
 On Wed, Jan 28, 2015 at 8:11 PM, Maciej Stachowiak m...@apple.com wrote:
 Yet another possibility is finding a better name than ‘shared’ for the 
 singleton pattern function, but I don’t have any better ideas. 
 Class::getSingleton() is more explicit but the extra verbosity doesn’t 
 seem helpful to me.
 
 I recommend Class::instance(), which is what I've seen used almost 
 exclusively outside of WebKit. It's what Scott Meyers used, and it's very 
 similar to the Gang of Four's choice of Class::Instance() and the Java 
 pattern Class.INSTANCE.
 
 That said, Class::singleton() is very attractive too.
 
 I've never seen Class::shared() used anywhere except WebKit. The first time 
 I saw this I had no clue what it was until I looked up the implementation.
 
 All of these can get quite annoying to type, especially when the name of 
 the class is long. (Sometimes I will keep a reference to the instance in a 
 local variable with a shorter name.) But I think they're easier to read 
 than free functions, and we should optimize for reading code, not writing 
 it. Not a big deal either way.
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev
 
 
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Ryosuke Niwa
On Wed, Jan 28, 2015 at 9:19 PM, Maciej Stachowiak m...@apple.com wrote:


 This may be a question of what jargon we've encountered, but to me,
 singleton clearly means the one unique instance of this class while
 instance means any instance of this class. If I hadn't seen this
 thread, I would interpret Class::instance() to mean create a brand new
 instance of this class rather than return the unique singleton instance
 of this class, creating if necessary.


Agreed.  I also prefer Class::singleton() over Class::instance().

- R. Niwa
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] WebRTC in WebKit

2015-01-28 Thread Benjamin Poulain

Getting WebRTC working on WebKitGTK sounds awesome.

I am a little concerned with the use of an abstraction layer as a 
backend. I am afraid this could lead to weird abstractions.


Typically in WebKit we try to have baseline code in C++ that handles 
everything that can be shared between ports, and platform abstractions 
for everything port and/or platform specific.


Using OpenWebRTC, there would be no abstractions and WebCore would just 
be a bridge between JavaScript and OpenWebRTC. Is that correct?


Could you explain a bit why you chose to use an abstraction layer at the 
WebRTC level instead of interfacing directly with GStreamer at the 
platform abstraction level?


Benjamin


On 1/28/15 2:28 AM, Adam Bergkvist wrote:

Hi

Back in 2011-2012 there was some work done to implement WebRTC in WebKit
by Google and Ericsson [1]. At the time, it was only the chromium port
that had a WebRTC backend implemented (webrtc.org) and a fully testable
implementation. As of late 2014, there is an alternative WebRTC
implementation out there; OpenWebRTC [2] is an open source WebRTC
framework based on GStreamer.

This is an announcement that we are a group of people/companies that
intend to continue the work on WebRTC in WebKit.

What we would like to do is to:
* Get the WebCore interfaces up to date. Quite a lot has changed in the
WebRTC API since the code landed in WebCore. For example, the
MediaStreamTrack has taken over most of the responsibilities previously
owned by MediaStream.

* Use OpenWebRTC as a WebRTC backend on the GTK+ port. Our approach
would be to use a stable platform interface on a lower level than the
W3C API (MediaStream API and RTCPeerConnecion) and implement the API
related details in WebCore. This would allow us to let API related
objects only exist in WebCore and not having to mirror them across layers.

* Evaluate the feasibility of multiple back-end support (e.g. webrtc.org
 OpenWebRTC).

This effort will involve quite a few people, including Adam Bergkvist
(Ericsson), Alex Gouaillard (Temasys), Philippe Normand (Igalia) and
Sebastian Dröge (Centricular).

Feedback and/or help is always appreciated.

BR
Adam, Alex, Philippe and Sebastian

[1] https://lists.webkit.org/pipermail/webkit-dev/2011-November/018445.html
[2] https://github.com/EricssonResearch/openwebrtc
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


[webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Chris Dumez
Hi,

I noticed that we are currently not very consistent in WebKit in the way we 
implement singleton classes instance getters.
- Some classes use free functions (like MemoryCache, and PageCache until I 
updated it yesterday). e.g. memoryCache().xxx()
- Some classes are using static functions in the class (e.g. 
DatabaseProcess::shared(), PluginProcess::shared()).

As I said, I landed a patch yesterday so that the global page cache is now 
accessed via PageCache::shared() because I thought this was the currently 
preferred pattern (given it seems very common in WebKit2 code).
However, I thought I would email webkit-dev to make sure this is actually the 
case and make sure we agree on a given pattern (one way or another) for current 
and future code. We could then maybe document this
as part of our coding style.

Any feedback on this matter?

Kr,
--
Chris Dumez - Apple Inc.
Cupertino, CA




___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Benjamin Poulain

IMHO, scoping the function by its class is cleaner.
http://trac.webkit.org/changeset/179247 looks like an improvement to me.

Benjamin

On 1/28/15 11:30 AM, Chris Dumez wrote:

Hi,

I noticed that we are currently not very consistent in WebKit in the 
way we implement singleton classes instance getters.
- Some classes use free functions (like MemoryCache, and PageCache 
until I updated it yesterday). e.g. memoryCache().xxx()
- Some classes are using static functions in the class 
(e.g. DatabaseProcess::shared(), PluginProcess::shared()).


As I said, I landed a patch yesterday so that the global page cache is 
now accessed via PageCache::shared() because I thought this was the 
currently preferred pattern (given it seems very common in WebKit2 code).
However, I thought I would email webkit-dev to make sure this is 
actually the case and make sure we agree on a given pattern (one way 
or another) for current and future code. We could then maybe document this

as part of our coding style.

Any feedback on this matter?

Kr,
--
Chris Dumez - Apple Inc.
Cupertino, CA






___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Pattern for singleton classes instance getters

2015-01-28 Thread Ryosuke Niwa
Class::shared() pattern seems good to me.

- R. Niwa

On Wed, Jan 28, 2015 at 11:38 AM, Benjamin Poulain benja...@webkit.org
wrote:

  IMHO, scoping the function by its class is cleaner.
 http://trac.webkit.org/changeset/179247 looks like an improvement to me.

 Benjamin


 On 1/28/15 11:30 AM, Chris Dumez wrote:

 Hi,

  I noticed that we are currently not very consistent in WebKit in the way
 we implement singleton classes instance getters.
 - Some classes use free functions (like MemoryCache, and PageCache until I
 updated it yesterday). e.g. memoryCache().xxx()
 - Some classes are using static functions in the class
 (e.g. DatabaseProcess::shared(), PluginProcess::shared()).

  As I said, I landed a patch yesterday so that the global page cache is
 now accessed via PageCache::shared() because I thought this was the
 currently preferred pattern (given it seems very common in WebKit2 code).
 However, I thought I would email webkit-dev to make sure this is actually
 the case and make sure we agree on a given pattern (one way or another) for
 current and future code. We could then maybe document this
 as part of our coding style.

  Any feedback on this matter?

  Kr,
  --
 Chris Dumez - Apple Inc.
 Cupertino, CA






 ___
 webkit-dev mailing 
 listwebkit-dev@lists.webkit.orghttps://lists.webkit.org/mailman/listinfo/webkit-dev



 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev