As far as I can see this is also the way we have organized the platform
specific parts of V8. We added the platform_posix.cc after having duplicated
quite a lot in _linux, _mac and _freebsd. This changelist follows this
pattern.


On Thu, Nov 26, 2009 at 12:10, <[email protected]> wrote:

> On 2009/11/25 22:24:20, Evan Martin wrote:
>
>> On 2009/11/25 22:21:23, Mikhail Naganov wrote:
>> > Can you please point out more concretely what '_os.c' files do you mean?
>> In
>> > Chromium, I can only find such files in sqlite and native_client. But in
>> > Chromium's own code I see lots of "#if defined(OS_LINUX) ||
>> > defined(OS_FREEBSD)"-like branches.
>>
>
>  I am attempting to remove many those.
>>
>
>  My general approach is:
>> if the function looks like
>> void f() {
>>   #if OS1
>>     implementation_1();
>>   #elif OS2
>>     implementation_2();
>> }
>> then it should be split into multiple files.
>>
>
>  Otherwise, if you need the occasional ifdef within shared code, it's ok.
>>
>
>  Take a look at some of the _freebsd files in Chrome's base/ and compare
>> them
>>
> to
>
>> the _linux or _posix ones (I've just been splitting them over the last
>> week).
>>
>
> OK, so it looks like the strategy in Chromium is as follows:
> - allow minimal spot-sized #ifdefs
> - split files otherwise, as follows:
>  - initially split into _posix and _win (and, possibly _mac)
>  - split _posix into _linux, _freebsd or whatever
>
> I like it. Evan, am I getting things right?
>
>
> http://codereview.chromium.org/431047
>

-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to