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

Side by Side Diff: trunk/src/mojo/shell/app_container.cc

Issue 62103015: Revert 234975 "Work in progress for end-to-end bindings" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « trunk/src/mojo/shell/app_container.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "mojo/shell/app_container.h" 5 #include "mojo/shell/app_container.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 AppContainer::~AppContainer() { 61 AppContainer::~AppContainer() {
62 } 62 }
63 63
64 void AppContainer::Load(const GURL& app_url) { 64 void AppContainer::Load(const GURL& app_url) {
65 request_ = context_->loader()->Load(app_url, this); 65 request_ = context_->loader()->Load(app_url, this);
66 } 66 }
67 67
68 void AppContainer::DidCompleteLoad(const GURL& app_url, 68 void AppContainer::DidCompleteLoad(const GURL& app_url,
69 const base::FilePath& app_path) { 69 const base::FilePath& app_path) {
70 Handle shell_handle;
71 Handle app_handle; 70 Handle app_handle;
72 MojoResult result = CreateMessagePipe(&shell_handle, &app_handle); 71 MojoResult result = CreateMessagePipe(&shell_handle_, &app_handle);
73 if (result < MOJO_RESULT_OK) { 72 if (result < MOJO_RESULT_OK) {
74 // Failure.. 73 // Failure..
75 } 74 }
76 75
77 hello_world_service_.reset(
78 new examples::HelloWorldServiceImpl(shell_handle));
79
80 // Launch the app on its own thread. 76 // Launch the app on its own thread.
81 // TODO(beng): Create a unique thread name. 77 // TODO(beng): Create a unique thread name.
82 thread_.reset(new base::Thread("app_thread")); 78 thread_.reset(new base::Thread("app_thread"));
83 thread_->Start(); 79 thread_->Start();
84 thread_->message_loop_proxy()->PostTaskAndReply( 80 thread_->message_loop_proxy()->PostTaskAndReply(
85 FROM_HERE, 81 FROM_HERE,
86 base::Bind(&LaunchAppOnThread, app_path, app_handle), 82 base::Bind(&LaunchAppOnThread, app_path, app_handle),
87 base::Bind(&AppContainer::AppCompleted, weak_factory_.GetWeakPtr())); 83 base::Bind(&AppContainer::AppCompleted, weak_factory_.GetWeakPtr()));
88 84
85 const char* hello_msg = "Hello";
86 result = WriteMessage(shell_handle_, hello_msg,
87 static_cast<uint32_t>(strlen(hello_msg)+1),
88 NULL, 0, MOJO_WRITE_MESSAGE_FLAG_NONE);
89 if (result < MOJO_RESULT_OK) {
90 // Failure..
91 }
92
89 // TODO(beng): This should be created on demand by the NativeViewportService 93 // TODO(beng): This should be created on demand by the NativeViewportService
90 // when it is retrieved by the app. 94 // when it is retrieved by the app.
91 // native_viewport_controller_.reset( 95 native_viewport_controller_.reset(
92 // new services::NativeViewportController(context_, shell_handle_)); 96 new services::NativeViewportController(context_, shell_handle_));
93 } 97 }
94 98
95 void AppContainer::AppCompleted() { 99 void AppContainer::AppCompleted() {
96 hello_world_service_.reset(); 100 native_viewport_controller_->Close();
97 // TODO(aa): This code gets replaced once we have a service manager.
98 // native_viewport_controller_->Close();
99 101
100 thread_.reset(); 102 thread_.reset();
103 Close(shell_handle_);
101 } 104 }
102 105
103 } // namespace shell 106 } // namespace shell
104 } // namespace mojo 107 } // namespace mojo
OLDNEW
« no previous file with comments | « trunk/src/mojo/shell/app_container.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698