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

Side by Side Diff: chrome/renderer/chrome_render_process_observer.cc

Issue 7866019: New implementation of font precache on Windows. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix Linux/Mac build break Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/chrome_render_process_observer.h" 5 #include "chrome/renderer/chrome_render_process_observer.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 27 matching lines...) Expand all
38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCrossOriginPreflig htResultCache.h" 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCrossOriginPreflig htResultCache.h"
39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFontCache.h" 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFontCache.h"
41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h"
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
44 #include "v8/include/v8.h" 44 #include "v8/include/v8.h"
45 45
46 #if defined(OS_WIN) 46 #if defined(OS_WIN)
47 #include "base/win/iat_patch_function.h" 47 #include "base/win/iat_patch_function.h"
48 #include "content/common/child_process_messages.h"
48 #endif 49 #endif
49 50
50 #if defined(OS_MACOSX) 51 #if defined(OS_MACOSX)
51 #include "base/eintr_wrapper.h" 52 #include "base/eintr_wrapper.h"
52 #include "chrome/app/breakpad_mac.h" 53 #include "chrome/app/breakpad_mac.h"
53 #endif 54 #endif
54 55
55 using WebKit::WebCache; 56 using WebKit::WebCache;
56 using WebKit::WebCrossOriginPreflightResultCache; 57 using WebKit::WebCrossOriginPreflightResultCache;
57 using WebKit::WebFontCache; 58 using WebKit::WebFontCache;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 DWORD length) { 159 DWORD length) {
159 int rv = GetFontData(hdc, table, offset, buffer, length); 160 int rv = GetFontData(hdc, table, offset, buffer, length);
160 if (rv == GDI_ERROR && hdc) { 161 if (rv == GDI_ERROR && hdc) {
161 HFONT font = static_cast<HFONT>(GetCurrentObject(hdc, OBJ_FONT)); 162 HFONT font = static_cast<HFONT>(GetCurrentObject(hdc, OBJ_FONT));
162 163
163 LOGFONT logfont; 164 LOGFONT logfont;
164 if (GetObject(font, sizeof(LOGFONT), &logfont)) { 165 if (GetObject(font, sizeof(LOGFONT), &logfont)) {
165 std::vector<char> font_data; 166 std::vector<char> font_data;
166 if (RenderThread::current()->Send(new ViewHostMsg_PreCacheFont(logfont))) 167 if (RenderThread::current()->Send(new ViewHostMsg_PreCacheFont(logfont)))
167 rv = GetFontData(hdc, table, offset, buffer, length); 168 rv = GetFontData(hdc, table, offset, buffer, length);
169 RenderThread::current()->Send(new ViewHostMsg_ReleaseCachedFonts);
168 } 170 }
169 } 171 }
170 return rv; 172 return rv;
171 } 173 }
172 #endif // OS_WIN 174 #endif // OS_WIN
173 175
174 #if defined(OS_POSIX) 176 #if defined(OS_POSIX)
175 class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter { 177 class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter {
176 void OnChannelError() { 178 void OnChannelError() {
177 // On POSIX, at least, one can install an unload handler which loops 179 // On POSIX, at least, one can install an unload handler which loops
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 } 543 }
542 544
543 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) 545 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC)
544 // Tell tcmalloc to release any free pages it's still holding. 546 // Tell tcmalloc to release any free pages it's still holding.
545 MallocExtension::instance()->ReleaseFreeMemory(); 547 MallocExtension::instance()->ReleaseFreeMemory();
546 #endif 548 #endif
547 549
548 if (client_) 550 if (client_)
549 client_->OnPurgeMemory(); 551 client_->OnPurgeMemory();
550 } 552 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698