Set correct thread priority on Linux.
Set correct thread priority on Linux.

When creating a thread with a different priority, the creating
thread's priority would be set.  Instead set the priority of the new
thread in the thread function.  Always set the priority to 0 first,
this addresses unwanted priority inheritance which was fixed for
android only before.  NACL doesn't seem to define setpriority(), so
handle that and OSX (and all posix that isn't linux), by using the
platform thread implementation.

BUG=174697
TEST=observe thread priorities with ps.
'ps -C chrome -Lo pid,tid,pri_api,rtprio,cmd'

Signed-off-by: Dylan Reid <dgreid@chromium.org>

Review URL: https://chromiumcodereview.appspot.com/12226040

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@185179 0039d316-1c4b-4281-b951-d872f2087c98

littlstar/chromium.src,TheTypoMaster/chromium-crosswalk,ltilve/chromium,jaruba/chromium.src,anirudhSK/chromium,Chilledheart/chromium,TheTypoMaster/chromium-crosswalk,ondra-novak/chromium.src,anirudhSK/chromium,crosswalk-project/chromium-crosswalk-efl,dushu1203/chromium.src,mogoweb/chromium-crosswalk,markYoungH/chromium.src,hujiajie/pa-chromium,Fireblend/chromium-crosswalk,pozdnyakov/chromium-crosswalk,ondra-novak/chromium.src,Chilledheart/chromium,hgl888/chromium-crosswalk,dushu1203/chromium.src,bright-sparks/chromium-spacewalk,crosswalk-project/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,fujunwei/chromium-crosswalk,ChromiumWebApps/chromium,hujiajie/pa-chromium,PeterWangIntel/chromium-crosswalk,Pluto-tv/chromium-crosswalk,patrickm/chromium.src,chuan9/chromium-crosswalk,ChromiumWebApps/chromium,ltilve/chromium,markYoungH/chromium.src,ChromiumWebApps/chromium,pozdnyakov/chromium-crosswalk,pozdnyakov/chromium-crosswalk,hujiajie/pa-chromium,bright-sparks/chromium-spacewalk,dushu1203/chromium.src,Just-D/chromium-1,Fireblend/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,krieger-od/nwjs_chromium.src,Jonekee/chromium.src,mogoweb/chromium-crosswalk,timopulkkinen/BubbleFish,Just-D/chromium-1,hujiajie/pa-chromium,mohamed--abdel-maksoud/chromium.src,pozdnyakov/chromium-crosswalk,dednal/chromium.src,mohamed--abdel-maksoud/chromium.src,Chilledheart/chromium,pozdnyakov/chromium-crosswalk,dushu1203/chromium.src,TheTypoMaster/chromium-crosswalk,ChromiumWebApps/chromium,anirudhSK/chromium,mogoweb/chromium-crosswalk,dednal/chromium.src,mogoweb/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,Jonekee/chromium.src,jaruba/chromium.src,markYoungH/chromium.src,fujunwei/chromium-crosswalk,Pluto-tv/chromium-crosswalk,fujunwei/chromium-crosswalk,dushu1203/chromium.src,ltilve/chromium,axinging/chromium-crosswalk,M4sse/chromium.src,M4sse/chromium.src,Jonekee/chromium.src,crosswalk-project/chromium-crosswalk-efl,ondra-novak/chromium.src,Fireblend/chromium-crosswalk,ondra-novak/chromium.src,dednal/chromium.src,TheTypoMaster/chromium-crosswalk,dednal/chromium.src,ChromiumWebApps/chromium,Chilledheart/chromium,mohamed--abdel-maksoud/chromium.src,littlstar/chromium.src,pozdnyakov/chromium-crosswalk,ChromiumWebApps/chromium,axinging/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,ltilve/chromium,dednal/chromium.src,Chilledheart/chromium,Just-D/chromium-1,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk,Jonekee/chromium.src,axinging/chromium-crosswalk,patrickm/chromium.src,crosswalk-project/chromium-crosswalk-efl,anirudhSK/chromium,timopulkkinen/BubbleFish,fujunwei/chromium-crosswalk,fujunwei/chromium-crosswalk,ondra-novak/chromium.src,Fireblend/chromium-crosswalk,patrickm/chromium.src,hujiajie/pa-chromium,axinging/chromium-crosswalk,patrickm/chromium.src,dednal/chromium.src,Just-D/chromium-1,Just-D/chromium-1,dushu1203/chromium.src,Chilledheart/chromium,krieger-od/nwjs_chromium.src,Fireblend/chromium-crosswalk,krieger-od/nwjs_chromium.src,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk,hujiajie/pa-chromium,hgl888/chromium-crosswalk-efl,Pluto-tv/chromium-crosswalk,bright-sparks/chromium-spacewalk,Jonekee/chromium.src,Pluto-tv/chromium-crosswalk,timopulkkinen/BubbleFish,littlstar/chromium.src,Fireblend/chromium-crosswalk,ltilve/chromium,M4sse/chromium.src,pozdnyakov/chromium-crosswalk,littlstar/chromium.src,Jonekee/chromium.src,M4sse/chromium.src,dednal/chromium.src,markYoungH/chromium.src,chuan9/chromium-crosswalk,dushu1203/chromium.src,bright-sparks/chromium-spacewalk,jaruba/chromium.src,hujiajie/pa-chromium,timopulkkinen/BubbleFish,chuan9/chromium-crosswalk,krieger-od/nwjs_chromium.src,M4sse/chromium.src,TheTypoMaster/chromium-crosswalk,dushu1203/chromium.src,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,PeterWangIntel/chromium-crosswalk,hujiajie/pa-chromium,krieger-od/nwjs_chromium.src,ChromiumWebApps/chromium,hujiajie/pa-chromium,pozdnyakov/chromium-crosswalk,ondra-novak/chromium.src,chuan9/chromium-crosswalk,mogoweb/chromium-crosswalk,hgl888/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,dednal/chromium.src,jaruba/chromium.src,mohamed--abdel-maksoud/chromium.src,chuan9/chromium-crosswalk,hgl888/chromium-crosswalk-efl,ChromiumWebApps/chromium,hujiajie/pa-chromium,Fireblend/chromium-crosswalk,krieger-od/nwjs_chromium.src,axinging/chromium-crosswalk,ltilve/chromium,pozdnyakov/chromium-crosswalk,patrickm/chromium.src,PeterWangIntel/chromium-crosswalk,ChromiumWebApps/chromium,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,markYoungH/chromium.src,markYoungH/chromium.src,chuan9/chromium-crosswalk,jaruba/chromium.src,timopulkkinen/BubbleFish,littlstar/chromium.src,patrickm/chromium.src,anirudhSK/chromium,ltilve/chromium,Chilledheart/chromium,hujiajie/pa-chromium,M4sse/chromium.src,axinging/chromium-crosswalk,Jonekee/chromium.src,pozdnyakov/chromium-crosswalk,jaruba/chromium.src,ondra-novak/chromium.src,fujunwei/chromium-crosswalk,dushu1203/chromium.src,Jonekee/chromium.src,M4sse/chromium.src,ChromiumWebApps/chromium,markYoungH/chromium.src,timopulkkinen/BubbleFish,anirudhSK/chromium,patrickm/chromium.src,timopulkkinen/BubbleFish,Pluto-tv/chromium-crosswalk,mogoweb/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk,axinging/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Chilledheart/chromium,jaruba/chromium.src,ChromiumWebApps/chromium,Just-D/chromium-1,bright-sparks/chromium-spacewalk,krieger-od/nwjs_chromium.src,Pluto-tv/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,Chilledheart/chromium,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,ltilve/chromium,ondra-novak/chromium.src,Pluto-tv/chromium-crosswalk,hgl888/chromium-crosswalk,patrickm/chromium.src,krieger-od/nwjs_chromium.src,TheTypoMaster/chromium-crosswalk,timopulkkinen/BubbleFish,PeterWangIntel/chromium-crosswalk,Just-D/chromium-1,anirudhSK/chromium,timopulkkinen/BubbleFish,krieger-od/nwjs_chromium.src,Just-D/chromium-1,anirudhSK/chromium,M4sse/chromium.src,markYoungH/chromium.src,markYoungH/chromium.src,mohamed--abdel-maksoud/chromium.src,TheTypoMaster/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,bright-sparks/chromium-spacewalk,ChromiumWebApps/chromium,markYoungH/chromium.src,dednal/chromium.src,bright-sparks/chromium-spacewalk,mogoweb/chromium-crosswalk,dednal/chromium.src,dushu1203/chromium.src,bright-sparks/chromium-spacewalk,hgl888/chromium-crosswalk-efl,patrickm/chromium.src,littlstar/chromium.src,markYoungH/chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Jonekee/chromium.src,Jonekee/chromium.src,jaruba/chromium.src,jaruba/chromium.src,mohamed--abdel-maksoud/chromium.src,ondra-novak/chromium.src,chuan9/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk,anirudhSK/chromium,krieger-od/nwjs_chromium.src,dednal/chromium.src,anirudhSK/chromium,Just-D/chromium-1,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,M4sse/chromium.src,M4sse/chromium.src,pozdnyakov/chromium-crosswalk,axinging/chromium-crosswalk,jaruba/chromium.src,anirudhSK/chromium,fujunwei/chromium-crosswalk,bright-sparks/chromium-spacewalk,timopulkkinen/BubbleFish,ltilve/chromium,hgl888/chromium-crosswalk-efl,Pluto-tv/chromium-crosswalk,littlstar/chromium.src,axinging/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,fujunwei/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,anirudhSK/chromium,littlstar/chromium.src,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk-efl,dushu1203/chromium.src,chuan9/chromium-crosswalk,chuan9/chromium-crosswalk,fujunwei/chromium-crosswalk,Jonekee/chromium.src,M4sse/chromium.src,mogoweb/chromium-crosswalk