Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: sky/engine/web/Sky.cpp

Issue 887883002: WTF should get time from base directly (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/platform/testing/RunAllTests.cpp ('k') | sky/engine/wtf/CurrentTime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 V8Initializer::initializeMainThreadIfNeeded(); 125 V8Initializer::initializeMainThreadIfNeeded();
126 126
127 addMessageLoopObservers(); 127 addMessageLoopObservers();
128 } 128 }
129 129
130 v8::Isolate* mainThreadIsolate() 130 v8::Isolate* mainThreadIsolate()
131 { 131 {
132 return V8PerIsolateData::mainThreadIsolate(); 132 return V8PerIsolateData::mainThreadIsolate();
133 } 133 }
134 134
135 static double currentTimeFunction()
136 {
137 return Platform::current()->currentTime();
138 }
139
140 static double monotonicallyIncreasingTimeFunction()
141 {
142 return Platform::current()->monotonicallyIncreasingTime();
143 }
144
145 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) 135 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length)
146 { 136 {
147 base::RandBytes(buffer, length); 137 base::RandBytes(buffer, length);
148 } 138 }
149 139
150 void initializeWithoutV8(Platform* platform) 140 void initializeWithoutV8(Platform* platform)
151 { 141 {
152 ASSERT(!s_webKitInitialized); 142 ASSERT(!s_webKitInitialized);
153 s_webKitInitialized = true; 143 s_webKitInitialized = true;
154 144
155 ASSERT(platform); 145 ASSERT(platform);
156 Platform::initialize(platform); 146 Platform::initialize(platform);
157 147
158 WTF::setRandomSource(cryptographicallyRandomValues); 148 WTF::setRandomSource(cryptographicallyRandomValues);
159 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction); 149 WTF::initialize();
160 WTF::initializeMainThread(); 150 WTF::initializeMainThread();
161 151
162 DEFINE_STATIC_LOCAL(CoreInitializer, initializer, ()); 152 DEFINE_STATIC_LOCAL(CoreInitializer, initializer, ());
163 initializer.init(); 153 initializer.init();
164 154
165 // There are some code paths (for example, running WebKit in the browser 155 // There are some code paths (for example, running WebKit in the browser
166 // process and calling into LocalStorage before anything else) where the 156 // process and calling into LocalStorage before anything else) where the
167 // UTF8 string encoding tables are used on a background thread before 157 // UTF8 string encoding tables are used on a background thread before
168 // they're set up. This is a problem because their set up routines assert 158 // they're set up. This is a problem because their set up routines assert
169 // they're running on the main WebKitThread. It might be possible to make 159 // they're running on the main WebKitThread. It might be possible to make
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void enableLogChannel(const char* name) 202 void enableLogChannel(const char* name)
213 { 203 {
214 #if !LOG_DISABLED 204 #if !LOG_DISABLED
215 WTFLogChannel* channel = getChannelFromName(name); 205 WTFLogChannel* channel = getChannelFromName(name);
216 if (channel) 206 if (channel)
217 channel->state = WTFLogChannelOn; 207 channel->state = WTFLogChannelOn;
218 #endif // !LOG_DISABLED 208 #endif // !LOG_DISABLED
219 } 209 }
220 210
221 } // namespace blink 211 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/platform/testing/RunAllTests.cpp ('k') | sky/engine/wtf/CurrentTime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698