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

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 per 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 DWORD length) { 158 DWORD length) {
159 int rv = GetFontData(hdc, table, offset, buffer, length); 159 int rv = GetFontData(hdc, table, offset, buffer, length);
160 if (rv == GDI_ERROR && hdc) { 160 if (rv == GDI_ERROR && hdc) {
161 HFONT font = static_cast<HFONT>(GetCurrentObject(hdc, OBJ_FONT)); 161 HFONT font = static_cast<HFONT>(GetCurrentObject(hdc, OBJ_FONT));
162 162
163 LOGFONT logfont; 163 LOGFONT logfont;
164 if (GetObject(font, sizeof(LOGFONT), &logfont)) { 164 if (GetObject(font, sizeof(LOGFONT), &logfont)) {
165 std::vector<char> font_data; 165 std::vector<char> font_data;
166 if (RenderThread::current()->Send(new ViewHostMsg_PreCacheFont(logfont))) 166 if (RenderThread::current()->Send(new ViewHostMsg_PreCacheFont(logfont)))
167 rv = GetFontData(hdc, table, offset, buffer, length); 167 rv = GetFontData(hdc, table, offset, buffer, length);
168 RenderThread::current()->Send(new ViewHostMsg_ReleaseCachedFonts);
168 } 169 }
169 } 170 }
170 return rv; 171 return rv;
171 } 172 }
172 #endif // OS_WIN 173 #endif // OS_WIN
173 174
174 #if defined(OS_POSIX) 175 #if defined(OS_POSIX)
175 class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter { 176 class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter {
176 void OnChannelError() { 177 void OnChannelError() {
177 // On POSIX, at least, one can install an unload handler which loops 178 // 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 } 542 }
542 543
543 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) 544 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC)
544 // Tell tcmalloc to release any free pages it's still holding. 545 // Tell tcmalloc to release any free pages it's still holding.
545 MallocExtension::instance()->ReleaseFreeMemory(); 546 MallocExtension::instance()->ReleaseFreeMemory();
546 #endif 547 #endif
547 548
548 if (client_) 549 if (client_)
549 client_->OnPurgeMemory(); 550 client_->OnPurgeMemory();
550 } 551 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698