Skip to content

Commit

Permalink
Merge mozilla-central to mozilla-inbound on a CLOSED TREE
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed May 8, 2015
2 parents 15c042b + 6b5929e commit ea97473
Show file tree
Hide file tree
Showing 15 changed files with 201 additions and 412 deletions.
73 changes: 71 additions & 2 deletions dom/ipc/ContentParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ class MemoryReportRequestParent : public PMemoryReportRequestParent

private:
const uint32_t mGeneration;
// Non-null if we haven't yet called EndProcessReport() on it.
// Non-null if we haven't yet called EndChildReport() on it.
nsRefPtr<nsMemoryReporterManager> mReporterManager;

ContentParent* Owner()
Expand Down Expand Up @@ -464,7 +464,7 @@ void
MemoryReportRequestParent::ActorDestroy(ActorDestroyReason aWhy)
{
if (mReporterManager) {
mReporterManager->EndProcessReport(mGeneration, aWhy == Deletion);
mReporterManager->EndChildReport(mGeneration, aWhy == Deletion);
mReporterManager = nullptr;
}
}
Expand Down Expand Up @@ -648,6 +648,7 @@ static const char* sObserverTopics[] = {
"profile-before-change",
NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC,
NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC,
"child-memory-reporter-request",
"memory-pressure",
"child-gc-request",
"child-cc-request",
Expand Down Expand Up @@ -1975,6 +1976,18 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
}
}

// Tell the memory reporter manager that this ContentParent is going away.
nsRefPtr<nsMemoryReporterManager> mgr =
nsMemoryReporterManager::GetOrCreate();
#ifdef MOZ_NUWA_PROCESS
bool isMemoryChild = !IsNuwaProcess();
#else
bool isMemoryChild = true;
#endif
if (mgr && isMemoryChild) {
mgr->DecrementNumChildProcesses();
}

// remove the global remote preferences observers
Preferences::RemoveObserver(this, "");

Expand Down Expand Up @@ -2248,6 +2261,15 @@ ContentParent::ContentParent(mozIApplication* aApp,

IToplevelProtocol::SetTransport(mSubprocess->GetChannel());

if (!aIsNuwaProcess) {
// Tell the memory reporter manager that this ContentParent exists.
nsRefPtr<nsMemoryReporterManager> mgr =
nsMemoryReporterManager::GetOrCreate();
if (mgr) {
mgr->IncrementNumChildProcesses();
}
}

std::vector<std::string> extraArgs;
if (aIsNuwaProcess) {
extraArgs.push_back("-nuwa");
Expand Down Expand Up @@ -2312,6 +2334,13 @@ ContentParent::ContentParent(ContentParent* aTemplate,
aPid,
*fd);

// Tell the memory reporter manager that this ContentParent exists.
nsRefPtr<nsMemoryReporterManager> mgr =
nsMemoryReporterManager::GetOrCreate();
if (mgr) {
mgr->IncrementNumChildProcesses();
}

mSubprocess->LaunchAndWaitForProcessHandle();

// Clone actors routed by aTemplate for this instance.
Expand Down Expand Up @@ -3033,6 +3062,46 @@ ContentParent::Observe(nsISupports* aSubject,
nsDependentString(aData)))
return NS_ERROR_NOT_AVAILABLE;
}
else if (!strcmp(aTopic, "child-memory-reporter-request")) {
bool isNuwa = false;
#ifdef MOZ_NUWA_PROCESS
isNuwa = IsNuwaProcess();
#endif
if (!isNuwa) {
unsigned generation;
int anonymize, minimize, identOffset = -1;
nsDependentString msg(aData);
NS_ConvertUTF16toUTF8 cmsg(msg);

if (sscanf(cmsg.get(),
"generation=%x anonymize=%d minimize=%d DMDident=%n",
&generation, &anonymize, &minimize, &identOffset) < 3
|| identOffset < 0) {
return NS_ERROR_INVALID_ARG;
}
// The pre-%n part of the string should be all ASCII, so the byte
// offset in identOffset should be correct as a char offset.
MOZ_ASSERT(cmsg[identOffset - 1] == '=');
MaybeFileDesc dmdFileDesc = void_t();
#ifdef MOZ_DMD
nsAutoString dmdIdent(Substring(msg, identOffset));
if (!dmdIdent.IsEmpty()) {
FILE *dmdFile = nullptr;
nsresult rv = nsMemoryInfoDumper::OpenDMDFile(dmdIdent, Pid(), &dmdFile);
if (NS_WARN_IF(NS_FAILED(rv))) {
// Proceed with the memory report as if DMD were disabled.
dmdFile = nullptr;
}
if (dmdFile) {
dmdFileDesc = FILEToFileDescriptor(dmdFile);
fclose(dmdFile);
}
}
#endif
unused << SendPMemoryReportRequestConstructor(
generation, anonymize, minimize, dmdFileDesc);
}
}
else if (!strcmp(aTopic, "child-gc-request")){
unused << SendGarbageCollect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,14 +643,12 @@ VCMFrameBufferEnum VCMJitterBuffer::GetFrame(const VCMPacket& packet,
// slices of the same lower-case frame (timestamp), the more complete
// solution for FindFrame that uses the seqNum and can move packets
// between sessions would be needed.
if (packet.completeNALU != kNaluComplete) {
*frame = incomplete_frames_.FindFrame(packet.seqNum, packet.timestamp);
if (*frame)
return kNoError;
*frame = decodable_frames_.FindFrame(packet.seqNum, packet.timestamp);
if (*frame && (*frame)->GetState() != kStateComplete)
return kNoError;
}
*frame = incomplete_frames_.FindFrame(packet.seqNum, packet.timestamp);
if (*frame)
return kNoError;
*frame = decodable_frames_.FindFrame(packet.seqNum, packet.timestamp);
if (*frame && (*frame)->GetState() != kStateComplete)
return kNoError;

// No match, return empty frame.
*frame = GetEmptyFrame();
Expand Down
12 changes: 0 additions & 12 deletions mobile/android/base/BrowserApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -2632,16 +2632,6 @@ private void showBrowserSearch() {

fm.beginTransaction().add(R.id.search_container, mBrowserSearch, BROWSER_SEARCH_TAG).commitAllowingStateLoss();
mBrowserSearch.setUserVisibleHint(true);

// We want to adjust the window size when the keyboard appears to bring the
// SearchEngineBar above the keyboard. However, adjusting the window size
// when hiding the keyboard results in graphical glitches where the keyboard was
// because nothing was being drawn underneath (bug 933422). This can be
// prevented drawing content under the keyboard (i.e. in the Window).
//
// We do this here because there are glitches when unlocking a device with
// BrowserSearch in the foreground if we use BrowserSearch.onStart/Stop.
getActivity().getWindow().setBackgroundDrawableResource(android.R.color.white);
}

private void hideBrowserSearch() {
Expand All @@ -2658,8 +2648,6 @@ private void hideBrowserSearch() {
getSupportFragmentManager().beginTransaction()
.remove(mBrowserSearch).commitAllowingStateLoss();
mBrowserSearch.setUserVisibleHint(false);

getWindow().setBackgroundDrawable(null);
}

/**
Expand Down
43 changes: 18 additions & 25 deletions mobile/android/base/home/BrowserSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@
* Fragment that displays frecency search results in a ListView.
*/
public class BrowserSearch extends HomeFragment
implements GeckoEventListener,
SearchEngineBar.OnSearchBarClickListener {
implements GeckoEventListener {

@RobocopTarget
public interface SuggestClientFactory {
Expand Down Expand Up @@ -125,9 +124,6 @@ public SuggestClient getSuggestClient(Context context, String template, int time
// The list showing search results
private HomeListView mList;

// The bar on the bottom of the screen displaying search engine options.
private SearchEngineBar mSearchEngineBar;

// Client that performs search suggestion queries.
// Public for testing.
@RobocopTarget
Expand Down Expand Up @@ -230,6 +226,23 @@ public void onDestroy() {
mSearchEngines = null;
}

@Override
public void onStart() {
super.onStart();

// Adjusting the window size when showing the keyboard results in the underlying
// activity being painted when the keyboard is hidden (bug 933422). This can be
// prevented by not resizing the window.
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
}

@Override
public void onStop() {
super.onStop();

getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}

@Override
public void onResume() {
super.onResume();
Expand All @@ -255,7 +268,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
// If the style of the list changes, inflate it from an XML.
mView = (LinearLayout) inflater.inflate(R.layout.browser_search, container, false);
mList = (HomeListView) mView.findViewById(R.id.home_list_view);
mSearchEngineBar = (SearchEngineBar) mView.findViewById(R.id.search_engine_bar);

return mView;
}
Expand All @@ -267,9 +279,6 @@ public void onDestroyView() {
EventDispatcher.getInstance().unregisterGeckoThreadListener(this,
"SearchEngines:Data");

mSearchEngineBar.setAdapter(null);
mSearchEngineBar = null;

mList.setAdapter(null);
mList = null;

Expand Down Expand Up @@ -341,12 +350,6 @@ public boolean onKey(View v, int keyCode, android.view.KeyEvent event) {
registerForContextMenu(mList);
EventDispatcher.getInstance().registerGeckoThreadListener(this,
"SearchEngines:Data");

// If the view backed by this Fragment is being recreated, we will not receive
// a new search engine data event so refresh the new search engine bar's data
// & Views with the data we have.
mSearchEngineBar.setSearchEngines(mSearchEngines);
mSearchEngineBar.setOnSearchBarClickListener(this);
}

@Override
Expand Down Expand Up @@ -584,8 +587,6 @@ private void setSearchEngines(JSONObject data) {
mAdapter.notifyDataSetChanged();
}

mSearchEngineBar.setSearchEngines(mSearchEngines);

// Show suggestions opt-in prompt only if suggestions are not enabled yet,
// user hasn't been prompted and we're not on a private browsing tab.
if (!mSuggestionsEnabled && !suggestionsPrompted && mSuggestClient != null) {
Expand All @@ -598,14 +599,6 @@ private void setSearchEngines(JSONObject data) {
filterSuggestions();
}

@Override
public void onSearchBarClickListener(final SearchEngine searchEngine) {
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.LIST_ITEM,
"searchenginebar");

mSearchListener.onSearch(searchEngine, mSearchTerm);
}

private void maybeSetSuggestClient(final String suggestTemplate, final boolean isPrivate) {
if (mSuggestClient != null || isPrivate) {
return;
Expand Down
Loading

0 comments on commit ea97473

Please sign in to comment.