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

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: Update for code review 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 DWORD offset, 157 DWORD offset,
157 LPVOID buffer, 158 LPVOID buffer,
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(
168 new ChildProcessHostMsg_PreCacheFont(logfont)))
167 rv = GetFontData(hdc, table, offset, buffer, length); 169 rv = GetFontData(hdc, table, offset, buffer, length);
170 RenderThread::current()->Send(
171 new ChildProcessHostMsg_ReleaseCachedFonts);
168 } 172 }
169 } 173 }
170 return rv; 174 return rv;
171 } 175 }
172 #endif // OS_WIN 176 #endif // OS_WIN
173 177
174 #if defined(OS_POSIX) 178 #if defined(OS_POSIX)
175 class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter { 179 class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter {
176 void OnChannelError() { 180 void OnChannelError() {
177 // On POSIX, at least, one can install an unload handler which loops 181 // 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 } 545 }
542 546
543 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) 547 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC)
544 // Tell tcmalloc to release any free pages it's still holding. 548 // Tell tcmalloc to release any free pages it's still holding.
545 MallocExtension::instance()->ReleaseFreeMemory(); 549 MallocExtension::instance()->ReleaseFreeMemory();
546 #endif 550 #endif
547 551
548 if (client_) 552 if (client_)
549 client_->OnPurgeMemory(); 553 client_->OnPurgeMemory();
550 } 554 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698