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